🐛 Require correct file in actions pages
Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$PAGE_NAME = "Close request";
|
||||
require_once __DIR__ . "/../../includes/header.php";
|
||||
require_once __DIR__ . "/../../includes/prereqs.php";
|
||||
|
||||
$request = get_request($db, $_GET['rid']);
|
||||
$authorised_users = get_subscribers($db, $request);
|
||||
@@ -9,20 +9,22 @@
|
||||
// Close request
|
||||
if ($is_authorised == true) {
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
try {
|
||||
// Process ticket data
|
||||
$stmt = "UPDATE tickets SET status = 'Closed' WHERE uuid=:uuid";
|
||||
$sql = $db->prepare($stmt);
|
||||
$sql->bindParam(':uuid', $_POST['rid']);
|
||||
$sql->execute();
|
||||
} catch (PDOException $e) {
|
||||
$new_ticket_alert = array("danger", "Failed to close request: " . $e->getMessage());
|
||||
}
|
||||
header('Location: /', true);
|
||||
try {
|
||||
// Process ticket data
|
||||
$stmt = "UPDATE tickets SET status = 'Closed' WHERE uuid=:uuid";
|
||||
$sql = $db->prepare($stmt);
|
||||
$sql->bindParam(':uuid', $request['uuid']);
|
||||
$sql->execute();
|
||||
} catch (PDOException $e) {
|
||||
$alert = array("danger", "Failed to close request: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
$newURL = "/";
|
||||
echo("<script>window.location = '$newURL'</script>");
|
||||
} else {
|
||||
$new_ticket_alert = array("danger", "You are not authorised to close this request.");
|
||||
header('Location: /view?rid=' . $request['uuid'], true);
|
||||
$alert = array("danger", "You are not authorised to close this request.");
|
||||
$newURL = "/view?rid=$request['uuid']";
|
||||
echo("<script>window.location = '$newURL'</script>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user