fixed the redirect
to handle everything properly
This commit is contained in:
@@ -20,8 +20,9 @@ class TicketController {
|
||||
|
||||
public function showTickets() {
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: index.php?controller=Auth&do=showLoginForm');
|
||||
exit;
|
||||
$this->view->setVars(['error' => 'Bitte melden Sie sich an, um Ihre Tickets zu sehen.']);
|
||||
$this->view->setDoMethodName('showLoginForm');
|
||||
return;
|
||||
}
|
||||
|
||||
$tickets = $this->ticketModel->getUserTickets($_SESSION['user_id']);
|
||||
@@ -30,20 +31,23 @@ class TicketController {
|
||||
|
||||
public function showBuyTicketForm() {
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: index.php?controller=Auth&do=showLoginForm');
|
||||
exit;
|
||||
$this->view->setVars(['error' => 'Bitte melden Sie sich an, um Tickets zu kaufen.']);
|
||||
$this->view->setDoMethodName('showLoginForm');
|
||||
return;
|
||||
}
|
||||
|
||||
$event_id = $_GET['event_id'] ?? null;
|
||||
if (!$event_id) {
|
||||
header('Location: index.php?controller=Event&do=showEvents');
|
||||
exit;
|
||||
$this->view->setVars(['error' => 'Keine Event-ID angegeben.']);
|
||||
$this->view->setDoMethodName('showEvents');
|
||||
return;
|
||||
}
|
||||
|
||||
$event = $this->eventModel->getEvent($event_id);
|
||||
if (!$event) {
|
||||
header('Location: index.php?controller=Event&do=showEvents');
|
||||
exit;
|
||||
$this->view->setVars(['error' => 'Event nicht gefunden.']);
|
||||
$this->view->setDoMethodName('showEvents');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if user already has a ticket for this event
|
||||
@@ -107,8 +111,9 @@ class TicketController {
|
||||
|
||||
public function deleteTicket() {
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: index.php?controller=Auth&do=showLoginForm');
|
||||
exit;
|
||||
$this->view->setVars(['error' => 'Bitte melden Sie sich an.']);
|
||||
$this->view->setDoMethodName('showLoginForm');
|
||||
return;
|
||||
}
|
||||
|
||||
$ticket_id = $_GET['ticket_id'] ?? null;
|
||||
@@ -116,7 +121,7 @@ class TicketController {
|
||||
$this->ticketModel->deleteTicket($ticket_id);
|
||||
}
|
||||
|
||||
header('Location: index.php?controller=Ticket&do=showTickets');
|
||||
exit;
|
||||
// Redirect to tickets page using JavaScript
|
||||
$this->view->setVars(['redirect' => 'index.php?controller=Ticket&do=showTickets']);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user