diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-30 09:35:40 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2021-04-30 09:35:40 +0300 |
commit | cf270f3726a8037ebef80888eb510172688e13a7 (patch) | |
tree | b0440dbdb1d2e9cfcb942e6cc103f9da7910b902 /bug/delete.php | |
parent | CRUD reports (diff) | |
download | bugtracker-cf270f3726a8037ebef80888eb510172688e13a7.tar.xz |
CRUD bugs
Diffstat (limited to 'bug/delete.php')
-rw-r--r-- | bug/delete.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bug/delete.php b/bug/delete.php index e69de29..9054151 100644 --- a/bug/delete.php +++ b/bug/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 bug to delete"; + goto redirect; +} + +$conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']); +$query = $conn->prepare("DELETE FROM bugs WHERE id=:bug_id"); +$query->bindParam(':bug_id', $_GET['id']); +if($query->execute()) { + echo "<h2>bug deleted</h2>"; +} else { + echo "<h2>bug failed to delete</h2>"; +} + +redirect: header("Refresh: 2; URL=$_SERVER[HTTP_REFERER]"); +footer: require_once(TEMPLATES_PATH . "/footer.php"); +?> |