🐛 Require correct file in actions pages

Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
2020-08-09 17:30:20 +01:00
parent 9e25c836bb
commit e5fa2c986e
6 changed files with 49 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
<?php
$PAGE_NAME = "Update request";
require_once __DIR__ . "/../../includes/header.php";
require_once __DIR__ . "/../../includes/prereqs.php";
$request = get_request($db, $_POST['rid']);
$authorised_users = get_subscribers($db, $request);
@@ -17,13 +17,16 @@
$sql->bindParam(':user', $_SESSION['uuid']);
$sql->bindParam(':msg', $_POST['msg']);
$sql->execute();
$alert = array("success", "Update saved successfully.");
} catch (PDOException $e) {
$new_ticket_alert = array("danger", "Failed to save update: " . $e->getMessage());
$alert = array("danger", "Failed to save update: " . $e->getMessage());
}
} else {
$new_ticket_alert = array("danger", "You are not authorised to update this request.");
header('Location: /view?rid=' . $request['uuid'], true);
$alert = array("danger", "You are not authorised to update this request.");
}
}
$newURL = "/view?rid=$request['uuid']";
echo("<script>window.location = '$newURL'</script>");
?>