Add delete page for admins
This commit is contained in:
parent
a9da01afc8
commit
4d8b24eb8c
2 changed files with 21 additions and 0 deletions
18
delete.php
Normal file
18
delete.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
include 'include/db.php';
|
||||||
|
include 'include/templates.php';
|
||||||
|
|
||||||
|
if (!isset($_GET['id'])) {
|
||||||
|
die("<meta http-equiv=\"refresh\" content=\"0; url=/\">");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAdmin(tokenToUuid($_COOKIE["meowboardSession"])) == 1) {
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$statement = $db->prepare("DELETE FROM images WHERE id = ?");
|
||||||
|
$statement->bindParam(1, $_GET['id'], SQLITE3_INTEGER);
|
||||||
|
$result = $statement->execute();
|
||||||
|
|
||||||
|
die("<meta http-equiv=\"refresh\" content=\"0; url=/\">");
|
||||||
|
}
|
||||||
|
?>
|
|
@ -19,5 +19,8 @@ echo '<br/><strong>Tags:</strong>';
|
||||||
for($x = 0; $x < count($tags); $x++) {
|
for($x = 0; $x < count($tags); $x++) {
|
||||||
printTag($tags[$x], true);
|
printTag($tags[$x], true);
|
||||||
}
|
}
|
||||||
|
if (isAdmin(tokenToUuid($_COOKIE["meowboardSession"])) == 1) {
|
||||||
|
echo '<form action="delete.php?id=' . $_GET['id'] . '" method="get"><input type="text" id="id" name="id"><br/><button>Delete</button>';
|
||||||
|
}
|
||||||
echo $footer;
|
echo $footer;
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue