Show sourcecode

The following files exists in this folder. Click to view.

webbutv3/word-app/

add-words.php
api/
components/
include.php
index.php
ini/
login.php
logout.php
practice.php
progress.php
public/
scripts/
util/
word.php

word.php

47 lines ASCII Windows (CRLF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
include "include.php";
$word quick_statment("SELECT * FROM word WHERE id=?""i"$_GET["id"])->fetch_assoc();
$translations quick_statment("SELECT * FROM translation WHERE word_id = ?""i"$word["id"]);

if (
$_GET["delete"]) {
    
// delte word, translations and translation settings and tries

    
foreach ($translations as $translation) {
        
quick_statment("DELETE FROM try_record WHERE translation_id=?""i"$translation["id"]);
        
quick_statment("DELETE FROM translation_settings WHERE translation_id=?""i"$translation["id"]);
        
quick_statment("DELETE FROM translation WHERE id=?""i"$translation["id"]);
    }

    
quick_statment("DELETE FROM word WHERE id=?""i"$word["id"]);

    
header("Location: " path_to_url((BASE_PATH "/index.php")));
}
?>


<!DOCTYPE html>
<html lang="en">

<head>
    <?php include "components/head.php" ?>
</head>

<body>
    <?php include "components/header.php"?>

    <main>
        <p><?php echo $word["word"]; ?></p>

        <?php foreach ($translations as $translation) { ?>
            <p><?php echo $translation["translation"?></p>
        <?php ?>

        <form action="">
            <input name="id" value="<?php echo $_GET["id"?>" hidden>
            <input name="delete" value="true" hidden>
            <button>delete</button>
        </form>
    </main>
</body>

</html>