diff --git a/app/Controllers/EventController.php b/app/Controllers/EventController.php index 768237e1622c6f635df468bbc14dde651b590ad7..be3d08ebf332dbcf82368bf5ef45ce0fb6a44f72 100644 --- a/app/Controllers/EventController.php +++ b/app/Controllers/EventController.php @@ -5,9 +5,12 @@ ob_start(); require_once(__DIR__ . '/../Models/Event.php'); if (!isset($_SESSION["user_id"])) { - // User is not authenticated; redirect to login page - header("Location: /app/Views/login/login.php"); - ob_end_flush(); + session_start(); + if (!isset($_SESSION["user_id"])) { + // User is not authenticated; redirect to login page + header("Location: /app/Views/login/login.php"); + ob_end_flush(); + } } class EventController { diff --git a/app/Controllers/PembelianController.php b/app/Controllers/PembelianController.php index 71ca957f4268789cedc42326aa7bc82f3948847c..4ae3e253c56d7027d7d8560455b6175d58300b5b 100644 --- a/app/Controllers/PembelianController.php +++ b/app/Controllers/PembelianController.php @@ -6,9 +6,12 @@ ob_start(); require_once(__DIR__ . '/../Models/Pembelian.php'); if (!isset($_SESSION["user_id"])) { - // User is not authenticated; redirect to login page - header("Location: /app/Views/login/login.php"); - ob_end_flush(); + session_start(); + if (!isset($_SESSION["user_id"])) { + // User is not authenticated; redirect to login page + header("Location: /app/Views/login/login.php"); + ob_end_flush(); + } } class PembelianController { @@ -72,6 +75,8 @@ class PembelianController { $ticketId = $_POST['ticketId']; $userId = $_POST['userId']; $this->purchaseTicket($ticketId,$userId); + header("Location: /app/Views/home/home.php"); + ob_end_flush(); } else { // Handle other actions here, if needed } diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 487149b61a658ac3eed7e74013beec20cbc3bfce..8879ba1a11aafe74f15f24b66208aeea90eb7c9e 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -1,14 +1,15 @@ <?php // app/controllers/ticketController.php - ob_start(); // require_once 'Ticket.php'; require_once(__DIR__ . '/../Models/Ticket.php'); - if (!isset($_SESSION["user_id"])) { - // User is not authenticated; redirect to login page - header("Location: /app/Views/login/login.php"); - ob_end_flush(); + session_start(); + if (!isset($_SESSION["user_id"])) { + // User is not authenticated; redirect to login page + header("Location: /app/Views/login/login.php"); + ob_end_flush(); + } } class TicketController { @@ -49,8 +50,9 @@ class TicketController { if (isset($_GET['ticketAction'])) { if ($_GET['ticketAction'] === 'getTicket') { unset($_GET['ticketAction']); - $eventId = $_GET['eventId']; + $eventId = $_POST['eventId']; $this->getEventTicketDetails($eventId); + // header("Location: Views/pembelian/pembelian.php"); } else { // Handle other actions here, if needed }