diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2022-03-25 15:05:15 +0100 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2022-03-25 15:05:15 +0100 |
| commit | 3df4ebc26d93afed16670e37edb26aa3b5a17317 (patch) | |
| tree | 462838b07a70bf6a2aced9541bfe81f08be0e05c /index.php | |
| parent | ca297c3df1cacc902cadb21bea4dbf525913325a (diff) | |
| download | mlos-3df4ebc26d93afed16670e37edb26aa3b5a17317.tar.gz mlos-3df4ebc26d93afed16670e37edb26aa3b5a17317.tar.zst mlos-3df4ebc26d93afed16670e37edb26aa3b5a17317.zip | |
Hotfix, remove all JS
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 45 |
1 files changed, 32 insertions, 13 deletions
@@ -10,7 +10,9 @@ </head> <?php +session_start(); require_once "src/data.php"; +$eid = $_SESSION["eid"]; [$data, $count] = get_data(); function is_pos(): bool { @@ -38,29 +40,44 @@ function is_pos(): bool </thead> <tbody> <?php if (is_pos()) { ?> - <?php foreach ($data as $d) { ?> + <?php foreach ($data as $d) { + $id = $d['id']; ?> <tr> <form action="api/change-order.php" method="post"> <td> - <?php if ($d["order"] !== $count) { ?> + <?php if ($d["order"] !== $count && $eid === null) { ?> <input type="hidden" name="old-order" value="<?= $d["order"] ?>"> <input type="hidden" name="new-order" value="<?= intval($d["order"]) + 1 ?>"> <input type="submit" value="pos -" /> <?php } ?> </td> </form> - <form action="api/remove.php" method="post"> - <td><input type="submit" onclick="edit(event)" value="E" data-id="<?= $d['id'] ?>"></td> - <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["name"]) ?></td> - <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["thumbnail"]) ?></td> - <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["author"]) ?></td> - <td data-id="<?= $d['id'] ?>"><?= $d["magazine"] ?></td> - <td><input type="submit" value="Remove" data-id="<?= $d['id'] ?>"></td> - <input type="hidden" name="id" value="<?= $d['id'] ?>" data-id="<?= $d['id'] ?>" /> - </form> + <?php if ("$eid" === $d["id"]) { ?> + <td></td> + <form action="api/add.php" method="post"> + <td><input type="text" name="name" value="<?= htmlspecialchars($d["name"]) ?>" /></td> + <td><input type="text" name="thumbnail" value="<?= htmlspecialchars($d["thumbnail"]) ?>" /></td> + <td><input type="text" name="author" value="<?= htmlspecialchars($d["author"]) ?>" /></td> + <td><input type="text" name="magazine" value="<?= $d["magazine"] ?>" /></td> + <td><input type="submit" value="Edit"></td> + <input type="hidden" name="id" value="<?= $d['id'] ?>" /> + </form> + <?php } else { ?> + <td> + <form action="/api/set-session.php?eid=<?= $id ?>" method="post"><input type="submit" value="E"></form> + </td> + <form action="api/remove.php" method="post"> + <td><?= htmlspecialchars($d["name"]) ?></td> + <td><?= htmlspecialchars($d["thumbnail"]) ?></td> + <td><?= htmlspecialchars($d["author"]) ?></td> + <td><?= $d["magazine"] ?></td> + <td><input type="submit" value="Remove"></td> + <input type="hidden" name="id" value="<?= $d['id'] ?>" /> + </form> + <?php } ?> <form action="api/change-order.php" method="post"> <td> - <?php if ($d["order"] !== "1") { ?> + <?php if ($d["order"] !== "1" && $eid === null) { ?> <input type="hidden" name="old-order" value="<?= $d["order"] ?>"> <input type="hidden" name="new-order" value="<?= intval($d["order"]) - 1 ?>"> <input type="submit" value="pos +" /> @@ -75,11 +92,13 @@ function is_pos(): bool <tr> <form action="api/remove.php" method="post"> <td></td> + <td></td> <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["name"]) ?></td> <td data-id="<?= $d['id'] ?>"><img src="/imgs/<?= htmlspecialchars($d["thumbnail"]) ?>" width="200" /></td> <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["author"]) ?></td> <td data-id="<?= $d['id'] ?>"><?= $d["magazine"] ?></td> <td></td> + <td></td> </form> </tr> <?php } ?> @@ -100,7 +119,7 @@ function is_pos(): bool </tbody> </table> <a href="/api/export.php">Export to xlsx</a> - <script src="/src/main.js"></script> + <!-- <script src="/src/main.js"></script> --> </body> </html> |
