🐛 Fix request closure problem #62

Merged
luketainton merged 1 commits from bug/61 into main 2020-08-10 14:24:30 +00:00

View File

@@ -8,18 +8,16 @@
// Close request
if ($is_authorised == true) {
if($_SERVER['REQUEST_METHOD'] == 'POST') {
try {
$stmt = "UPDATE tickets SET status='Closed' WHERE uuid=:uuid";
$sql = $db->prepare($stmt);
$sql->bindParam(':uuid', $_GET['rid']);
$sql->execute();
} catch (PDOException $e) {
$alert = array("danger", "Failed to close request: " . $e->getMessage());
}
}
$newURL = "/";
echo("<script>window.location = '$newURL'</script>");
try {
$stmt = "UPDATE tickets SET status='Closed' WHERE uuid=:uuid";
$sql = $db->prepare($stmt);
$sql->bindParam(':uuid', $_GET['rid']);
$sql->execute();
} catch (PDOException $e) {
$alert = array("danger", "Failed to close request: " . $e->getMessage());
}
$newURL = "/";
echo("<script>window.location = '$newURL'</script>");
} else {
$alert = array("danger", "You are not authorised to close this request.");
$newURL = "/view?rid=" . $request['uuid'];