diff --git a/app/public/actions/close.php b/app/public/actions/close.php index a40f9d7..432fc3c 100644 --- a/app/public/actions/close.php +++ b/app/public/actions/close.php @@ -1,6 +1,6 @@ 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(""); } 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(""); } ?> diff --git a/app/public/actions/create.php b/app/public/actions/create.php index f2cd138..a512743 100644 --- a/app/public/actions/create.php +++ b/app/public/actions/create.php @@ -1,5 +1,5 @@ \ No newline at end of file +?> diff --git a/app/public/actions/update.php b/app/public/actions/update.php index 74fe63c..e498f8c 100644 --- a/app/public/actions/update.php +++ b/app/public/actions/update.php @@ -1,6 +1,6 @@ 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(""); + ?> diff --git a/app/public/actions/upload.php b/app/public/actions/upload.php index 76e3e26..4b53191 100644 --- a/app/public/actions/upload.php +++ b/app/public/actions/upload.php @@ -1,6 +1,7 @@ getMessage()); } - header('Location: /view?rid=' . $request['uuid'], true); + $newURL = "/view?rid=$request['uuid']"; + echo(""); } } 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(""); } } diff --git a/app/public/existing.php b/app/public/existing.php index 6fb5947..36b120a 100644 --- a/app/public/existing.php +++ b/app/public/existing.php @@ -1,6 +1,5 @@ + + + + " . $alert[1] . " + + × + + + + "); + unset($new_ticket_alert); + } + ?> + +