diff --git a/create_event.php b/create_event.php new file mode 100644 index 0000000..3f1a879 --- /dev/null +++ b/create_event.php @@ -0,0 +1,152 @@ + '/']); +session_start(); + +// If the user is not logged in, redirect to the login page +if (!isset($_SESSION['user'])) { + header('Location: login.php'); + exit; +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $eventsJson = file_get_contents('events.json'); + $events = json_decode($eventsJson, true); + + $newEvent = [ + 'title' => $_POST['title'], + 'date' => $_POST['date'], + 'time' => $_POST['time'], + 'details' => $_POST['details'] + ]; + + $events[] = $newEvent; + + file_put_contents('events.json', json_encode($events, JSON_PRETTY_PRINT)); + + header('Location: index.php'); + exit; +} + +?> + + + + + + Create Event + + + + + + +
+
+

Create New Event

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ Back to Dashboard +
+
+ + diff --git a/edit_event.php b/edit_event.php index 8417a73..de422da 100644 --- a/edit_event.php +++ b/edit_event.php @@ -103,7 +103,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { color: var(--text-color); font-family: 'Inter', sans-serif; } - button { + button, .button { background-color: var(--text-color); color: var(--button-text-color); border: none; @@ -112,8 +112,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { cursor: pointer; font-weight: 700; transition: background-color 0.3s, color 0.3s; + text-decoration: none; + display: inline-block; } - button:hover { + button:hover, .button:hover { background-color: #f0f0f0; } @@ -136,6 +138,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { + Back diff --git a/index.php b/index.php index 9852a9a..a5ff5b7 100644 --- a/index.php +++ b/index.php @@ -129,7 +129,10 @@ $user = $_SESSION['user'];
-

Event Schedule

+
+

Event Schedule

+ Create New Event +