<?php require_once 'controller/Controller.php'; session_start(); $c = new Controller(); try { $c->createEvent($_POST['event_name'], $_POST['event_date'], $_POST['starttime'], $_POST['endtime']); // Clearing unrelated errors $_SESSION["errorRegisterEvent"] = ""; $_SESSION["errorRegisterParticipant"] = ""; $_SESSION["errorParticipantName"] = ""; $_SESSION["errorEventName"] = ""; } catch (Exception $e) { $_SESSION["errorEventName"] = $e->getMessage(); } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="refresh" content="0; url=/EventRegistration/" /> </head> </html>
} else { date('Y-m-d', strtotime($date)); } $start = $_POST["starttime"]; if (strtotime($start) == false) { $start = NULL; } else { date('H:i', strtotime($start)); } $end = $_POST["endtime"]; if (strtotime($end) == false) { $end = NULL; } else { date('H:i', strtotime($end)); } $c->createEvent($_POST["event_name"], $date, $start, $end); $_SESSION["errorEvent"] = ""; $_SESSION["errorDate"] = ""; $_SESSION["startTimeError"] = ""; $_SESSION["endTimeError"] = ""; $_SESSION["endBeforeStart"] = ""; } catch (Exception $e) { $errors = explode("@", $e->getMessage()); foreach ($errors as $error) { if (substr($error, 0, 1) == "1") { $_SESSION["errorEvent"] = substr($error, 1); } if (substr($error, 0, 1) == "2") { $_SESSION["errorDate"] = substr($error, 1); } if (substr($error, 0, 1) == "3") {