From 7319816b7c712cd16d6e83bcd617c95943b79be6 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 29 Apr 2021 20:43:35 +0300 Subject: CRUD reports --- report/update.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 report/update.php (limited to 'report/update.php') diff --git a/report/update.php b/report/update.php new file mode 100644 index 0000000..0fadb53 --- /dev/null +++ b/report/update.php @@ -0,0 +1,28 @@ +prepare("INSERT INTO reports (author, title, description) VALUES (:user_id, :title, :description)") + : $conn->prepare("UPDATE reports SET title=:title, description=:description WHERE id=:report_id"); + if($_POST['id'] == "") { + $query->bindParam(':user_id', $_SESSION['user_id']); + } else { + $query->bindParam(':report_id', $_POST['id']); + } + $query->bindParam(':title', $_POST['title']); + $query->bindParam(':description', $_POST['description']); + if($query->execute()) { + echo "

report submitted

"; + } else { + echo "

report failed to submit

"; + } +} + +header("Refresh: 2; URL=$_SERVER[HTTP_REFERER]"); +footer: require_once(TEMPLATES_PATH . "/footer.php"); +?> -- cgit v1.2.1