diff options
Diffstat (limited to 'report/delete.php')
-rw-r--r-- | report/delete.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/report/delete.php b/report/delete.php new file mode 100644 index 0000000..1e43244 --- /dev/null +++ b/report/delete.php @@ -0,0 +1,28 @@ +<?php +require '../config.php'; +require_once(TEMPLATES_PATH . "/header.php"); +require_once(TEMPLATES_PATH . "/panel.php"); +require_once(LIBRARY_PATH . "/functions.php"); + +if(!session_set()) { + echo "You need to be logged in"; + goto redirect; +} + +if($_GET['id'] == "") { + echo "No report to delete"; + goto redirect; +} + +$conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']); +$query = $conn->prepare("DELETE FROM reports WHERE id=:report_id"); +$query->bindParam(':report_id', $_GET['id']); +if($query->execute()) { + echo "<h2>report deleted</h2>"; +} else { + echo "<h2>report failed to delete</h2>"; +} + +redirect: header("Refresh: 2; URL=$_SERVER[HTTP_REFERER]"); +footer: require_once(TEMPLATES_PATH . "/footer.php"); +?> |