diff --git a/dashboard.php b/dashboard.php deleted file mode 100644 index 52e4c12..0000000 --- a/dashboard.php +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - Dashboard - - - -
-
-

Dashboard

- Logout -
- -

Welcome, !

- -
-

Event Schedule

-

(Coming soon)

- - - - - - - - - - - - - - - - - - - - - - - -
#EventDateTime
1Team Meeting2025-09-0110:00 AM
2Project Deadline2025-09-055:00 PM
-
-
- - diff --git a/delete_event.php b/delete_event.php new file mode 100644 index 0000000..07b6b7c --- /dev/null +++ b/delete_event.php @@ -0,0 +1,141 @@ + '/']); +session_start(); + +// If the user is not logged in, redirect to the login page +if (!isset($_SESSION['user'])) { + header('Location: login.php'); + exit; +} + +$eventsJson = file_get_contents('events.json'); +$events = json_decode($eventsJson, true); + +$eventId = $_GET['id'] ?? null; + +if ($eventId === null || !isset($events[$eventId])) { + // Redirect to index if event not found + header('Location: index.php'); + exit; +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + // Delete the event + unset($events[$eventId]); + + // Re-index the array to prevent issues with json_encode + $events = array_values($events); + + file_put_contents('events.json', json_encode($events, JSON_PRETTY_PRINT)); + + header('Location: index.php'); + exit; +} + +$event = $events[$eventId]; + +?> + + + + + + Delete Event + + + + + + +
+
+

Delete Event

+

Are you sure you want to delete this event? This action cannot be undone.

+
+
+
+
+
+ Cancel + +
+
+
+ + \ No newline at end of file diff --git a/edit_event.php b/edit_event.php new file mode 100644 index 0000000..8417a73 --- /dev/null +++ b/edit_event.php @@ -0,0 +1,143 @@ + '/']); +session_start(); + +// If the user is not logged in, redirect to the login page +if (!isset($_SESSION['user'])) { + header('Location: login.php'); + exit; +} + +$eventsJson = file_get_contents('events.json'); +$events = json_decode($eventsJson, true); + +$eventId = $_GET['id'] ?? null; +$event = null; + +if ($eventId !== null && isset($events[$eventId])) { + $event = $events[$eventId]; +} else { + // Redirect to index if event not found + header('Location: index.php'); + exit; +} + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + // Update the event + $events[$eventId]['title'] = $_POST['title'] ?? $event['title']; + $events[$eventId]['time'] = $_POST['time'] ?? $event['time']; + $events[$eventId]['details'] = $_POST['details'] ?? $event['details']; + + file_put_contents('events.json', json_encode($events, JSON_PRETTY_PRINT)); + + header('Location: index.php'); + exit; +} + +?> + + + + + + Edit Event + + + + + + +
+
+

Edit Event

+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + \ No newline at end of file diff --git a/events.json b/events.json new file mode 100644 index 0000000..86d935a --- /dev/null +++ b/events.json @@ -0,0 +1,18 @@ + +[ + { + "title": "Team Stand-up", + "time": "Today, 9:00 AM", + "details": "Daily check-in to sync on progress and blockers." + }, + { + "title": "Design Review", + "time": "Today, 1:00 PM", + "details": "Review the new dashboard mockups and provide feedback." + }, + { + "title": "Deployment", + "time": "Today, 4:00 PM", + "details": "Deploy the latest changes to the staging environment." + } +] diff --git a/index.php b/index.php index c5a797c..9852a9a 100644 --- a/index.php +++ b/index.php @@ -3,24 +3,21 @@ declare(strict_types=1); session_set_cookie_params(['path' => '/']); session_start(); -if (isset($_SESSION['user'])) { - header('Location: dashboard.php'); +// If the user is not logged in, redirect to the login page +if (!isset($_SESSION['user'])) { + header('Location: login.php'); exit; } -@ini_set('display_errors', '1'); -@error_reporting(E_ALL); -@date_default_timezone_set('UTC'); +$user = $_SESSION['user']; -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); ?> - New Style + Dashboard @@ -29,8 +26,9 @@ $now = date('Y-m-d H:i:s'); --bg-color-start: #6a11cb; --bg-color-end: #2575fc; --text-color: #ffffff; - --card-bg-color: rgba(255, 255, 255, 0.01); - --card-border-color: rgba(255, 255, 255, 0.1); + --card-bg-color: rgba(255, 255, 255, 0.05); + --card-border-color: rgba(255, 255, 255, 0.2); + --button-text-color: #2575fc; } body { margin: 0; @@ -42,26 +40,11 @@ $now = date('Y-m-d H:i:s'); align-items: center; min-height: 100vh; text-align: center; - overflow: hidden; - position: relative; - } - body::before { - content: ''; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-image: url('data:image/svg+xml,'); - animation: bg-pan 20s linear infinite; - z-index: -1; - } - @keyframes bg-pan { - 0% { background-position: 0% 0%; } - 100% { background-position: 100% 100%; } } main { padding: 2rem; + width: 80%; + max-width: 960px; } .card { background: var(--card-bg-color); @@ -72,41 +55,104 @@ $now = date('Y-m-d H:i:s'); -webkit-backdrop-filter: blur(20px); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); } + .header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 2rem; + } h1 { - font-size: 3rem; + font-size: 2rem; font-weight: 700; - margin: 0 0 1rem; - letter-spacing: -1px; + margin: 0; + text-align: left; } - p { - margin: 0.5rem 0; - font-size: 1.1rem; + a.logout { + color: var(--text-color); + text-decoration: none; + border: 1px solid var(--card-border-color); + padding: 0.75rem 1.5rem; + border-radius: 8px; + transition: background-color 0.3s, color 0.3s; } - code { - background: rgba(0,0,0,0.2); - padding: 2px 6px; - border-radius: 4px; - font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; + a.logout:hover { + background-color: var(--text-color); + color: var(--button-text-color); } - footer { - position: absolute; - bottom: 1rem; - font-size: 0.8rem; - opacity: 0.7; + .schedule { + text-align: left; + } + h2 { + font-size: 1.5rem; + margin-bottom: 1rem; + border-bottom: 1px solid var(--card-border-color); + padding-bottom: 0.5rem; + } + .event { + background: rgba(0,0,0,0.1); + padding: 1rem; + border-radius: 8px; + margin-bottom: 1rem; + } + .event-title { + font-weight: 700; + } + .event-time { + font-size: 0.9rem; + opacity: 0.8; + margin-bottom: 1rem; + } + .event-actions { + margin-top: 1rem; + } + .event-actions a { + color: var(--text-color); + text-decoration: none; + border: 1px solid var(--card-border-color); + padding: 0.5rem 1rem; + border-radius: 8px; + transition: background-color 0.3s, color 0.3s; + margin-right: 0.5rem; + } + .event-actions a:hover { + background-color: var(--text-color); + color: var(--button-text-color); }
-

Welcome!

-

Your project is ready to conquer the peaks.

-

PHP version:

-

Logout

+
+

Welcome, !

+ Logout +
+ +
+

Event Schedule

+ $event) { + echo '
'; + echo '
' . htmlspecialchars($event['title']) . '
'; + echo '
' . htmlspecialchars($event['time']) . '
'; + echo '

' . htmlspecialchars($event['details']) . '

'; + echo '
'; + echo 'Edit'; + echo 'Delete'; + echo '
'; + echo '
'; + } + } else { + echo '

No events scheduled.

'; + } + ?> +
+
- \ No newline at end of file diff --git a/login.php b/login.php index 929d6b9..66eac51 100644 --- a/login.php +++ b/login.php @@ -12,7 +12,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Dummy authentication if ($username === 'admin' && $password === 'password') { $_SESSION['user'] = ['name' => 'Admin']; - header('Location: dashboard.php'); + header('Location: index.php'); exit; } else { $error = 'Invalid username or password';