diff --git a/app/Controllers/EventController.php b/app/Controllers/EventController.php index 7e43171b3943362878240cbdc32a7f16ea86d06c..f5b19aa5b75ae19e504ca4cd516b40487d49f059 100644 --- a/app/Controllers/EventController.php +++ b/app/Controllers/EventController.php @@ -54,5 +54,15 @@ class EventController { } } + public function handleRequest() { + if (isset($_GET['action'])) { + if ($_GET['action'] === 'purchaseTicket') { + + } else { + // Handle other actions here, if needed + } + } + } + } ?> \ No newline at end of file diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 8e65e817bfb130e8bd408dc525a7a78751b78a96..b275ad96f0f6171565834d23871d6260107a8aaf 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -32,5 +32,15 @@ class TicketController { include(__DIR__ . '/../Views/pembelian/pembelian.php'); } + + public function handleRequest() { + if (isset($_GET['action'])) { + if ($_GET['action'] === 'purchaseTicket') { + + } else { + // Handle other actions here, if needed + } + } + } } ?> diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index f644678939f1569675e8a337566a24bf47e46f34..c4f59a22a3794ada2062566fcec2163a36ec48d8 100644 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -65,5 +65,22 @@ class UserController { } } + public function handleRequest() { + if (isset($_POST['userAction'])) { + if ($_POST['userAction'] === 'login') { + unset($_POST['userAction']); + $emailOrUsername = $_POST['loginIdentifier']; + $password = $_POST['loginPassword']; + if (filter_var($emailOrUsername, FILTER_VALIDATE_EMAIL)){ + echo $this->loginByEmail($emailOrUsername, $password); + } else { + echo $this->loginByUsername($emailOrUsername,$password); + } + } else { + // Handle other actions here, if needed + } + } + } + } ?> diff --git a/app/router.php b/app/router.php new file mode 100644 index 0000000000000000000000000000000000000000..3239b92987e5d63e18bbd359c46d6380f590d62e --- /dev/null +++ b/app/router.php @@ -0,0 +1,24 @@ +<?php + +require_once './Controllers/PembelianController.php'; +require_once './Controllers/TicketController.php'; +require_once './Controllers/UserController.php'; +require_once './Controllers/EventController.php'; + +$eventController = new EventController(); +$pembelianController = new PembelianController(); +$ticketController = new TicketController(); +$userController = new UserController(); + +if ($_SERVER["REQUEST_METHOD"] == "POST") { + if (isset($_POST["eventAction"])) { + $eventController->handleRequest(); + } elseif (isset($_POST["ticketAction"])) { + $ticketController->handleRequest(); + } elseif (isset($_POST["userAction"])) { + $userController->handleRequest(); + } elseif (isset($_POST["purchaseAction"])) { + $pembelianController->handleRequest(); + } +} +?> \ No newline at end of file