Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de65f7432a | ||
|
|
8e8aeb4a48 | ||
|
|
5af5075ae6 |
152
create_event.php
Normal file
152
create_event.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
session_set_cookie_params(['path' => '/']);
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Create Event</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.05);
|
||||
--card-border-color: rgba(255, 255, 255, 0.2);
|
||||
--button-text-color: #2575fc;
|
||||
--input-bg-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
text-align: left;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
input, textarea {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--card-border-color);
|
||||
background-color: var(--input-bg-color);
|
||||
color: var(--text-color);
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-size: 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
button {
|
||||
background-color: var(--text-color);
|
||||
color: var(--button-text-color);
|
||||
border: none;
|
||||
padding: 1rem 2rem;
|
||||
border-radius: 8px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
width: 100%;
|
||||
font-size: 1rem;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.back-link {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 2rem;
|
||||
color: var(--text-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Create New Event</h1>
|
||||
<form method="POST">
|
||||
<div class="form-group">
|
||||
<label for="title">Event Title</label>
|
||||
<input type="text" id="title" name="title" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="date">Date</label>
|
||||
<input type="date" id="date" name="date" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time">Time</label>
|
||||
<input type="time" id="time" name="time" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="details">Details</label>
|
||||
<textarea id="details" name="details" rows="4" required></textarea>
|
||||
</div>
|
||||
<button type="submit">Create Event</button>
|
||||
</form>
|
||||
<a href="index.php" class="back-link">Back to Dashboard</a>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
141
delete_event.php
Normal file
141
delete_event.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
session_set_cookie_params(['path' => '/']);
|
||||
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];
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Delete Event</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.05);
|
||||
--card-border-color: rgba(255, 255, 255, 0.2);
|
||||
--button-text-color: #2575fc;
|
||||
--danger-color: #ff4d4d;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
text-align: left;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
p {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.event-details {
|
||||
background: rgba(0,0,0,0.1);
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.event-title {
|
||||
font-weight: 700;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 1rem;
|
||||
}
|
||||
button, a {
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
padding: 1rem 2rem;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-weight: 700;
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
}
|
||||
.delete-btn {
|
||||
background-color: var(--danger-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
.cancel-link {
|
||||
background-color: var(--text-color);
|
||||
color: var(--button-text-color);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Delete Event</h1>
|
||||
<p>Are you sure you want to delete this event? This action cannot be undone.</p>
|
||||
<div class="event-details">
|
||||
<div class="event-title"><?= htmlspecialchars($event['title']) ?></div>
|
||||
<div><?= htmlspecialchars($event['time']) ?></div>
|
||||
</div>
|
||||
<form method="POST" class="actions">
|
||||
<a href="index.php" class="cancel-link">Cancel</a>
|
||||
<button type="submit" class="delete-btn">Yes, Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
146
edit_event.php
Normal file
146
edit_event.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
session_set_cookie_params(['path' => '/']);
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Edit Event</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.05);
|
||||
--card-border-color: rgba(255, 255, 255, 0.2);
|
||||
--button-text-color: #2575fc;
|
||||
--input-bg-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
text-align: left;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
input, textarea {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--card-border-color);
|
||||
background-color: var(--input-bg-color);
|
||||
color: var(--text-color);
|
||||
font-family: 'Inter', sans-serif;
|
||||
}
|
||||
button, .button {
|
||||
background-color: var(--text-color);
|
||||
color: var(--button-text-color);
|
||||
border: none;
|
||||
padding: 1rem 2rem;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-weight: 700;
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
button:hover, .button:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Edit Event</h1>
|
||||
<form method="POST">
|
||||
<div class="form-group">
|
||||
<label for="title">Event Title</label>
|
||||
<input type="text" id="title" name="title" value="<?= htmlspecialchars($event['title']) ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time">Event Time</label>
|
||||
<input type="text" id="time" name="time" value="<?= htmlspecialchars($event['time']) ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="details">Event Details</label>
|
||||
<textarea id="details" name="details" rows="4" required><?= htmlspecialchars($event['details']) ?></textarea>
|
||||
</div>
|
||||
<button type="submit">Update Event</button>
|
||||
<a href="index.php" class="button">Back</a>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
18
events.json
Normal file
18
events.json
Normal file
@ -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."
|
||||
}
|
||||
]
|
||||
152
index.php
152
index.php
@ -1,18 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
session_set_cookie_params(['path' => '/']);
|
||||
session_start();
|
||||
|
||||
// If the user is not logged in, redirect to the login page
|
||||
if (!isset($_SESSION['user'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$user = $_SESSION['user'];
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<title>Dashboard</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
@ -21,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;
|
||||
@ -34,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,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
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);
|
||||
@ -64,40 +55,107 @@ $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);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Welcome!</h1>
|
||||
<p>Your project is ready to conquer the peaks.</p>
|
||||
<p>PHP version: <code><?= htmlspecialchars($phpVersion) ?></code></p>
|
||||
<div class="header">
|
||||
<h1>Welcome, <?= htmlspecialchars($user['name']) ?>!</h1>
|
||||
<a href="logout.php" class="logout">Logout</a>
|
||||
</div>
|
||||
|
||||
<div class="schedule">
|
||||
<div class="header">
|
||||
<h2>Event Schedule</h2>
|
||||
<a href="create_event.php" class="logout">Create New Event</a>
|
||||
</div>
|
||||
<?php
|
||||
$eventsJson = file_get_contents('events.json');
|
||||
$events = json_decode($eventsJson, true);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE && !empty($events)) {
|
||||
foreach ($events as $index => $event) {
|
||||
echo '<div class="event">';
|
||||
echo '<div class="event-title">' . htmlspecialchars($event['title']) . '</div>';
|
||||
echo '<div class="event-time">' . htmlspecialchars($event['time']) . '</div>';
|
||||
echo '<p>' . htmlspecialchars($event['details']) . '</p>';
|
||||
echo '<div class="event-actions">';
|
||||
echo '<a href="edit_event.php?id=' . $index . '">Edit</a>';
|
||||
echo '<a href="delete_event.php?id=' . $index . '">Delete</a>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
} else {
|
||||
echo '<p>No events scheduled.</p>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
130
login.php
Normal file
130
login.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
session_set_cookie_params(['path' => '/']);
|
||||
session_start();
|
||||
|
||||
$error = null;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$username = $_POST['username'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
// Dummy authentication
|
||||
if ($username === 'admin' && $password === 'password') {
|
||||
$_SESSION['user'] = ['name' => 'Admin'];
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
} else {
|
||||
$error = 'Invalid username or password';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Login</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--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);
|
||||
--input-bg-color: rgba(255, 255, 255, 0.1);
|
||||
--input-border-color: rgba(255, 255, 255, 0.2);
|
||||
--button-bg-color: #ffffff;
|
||||
--button-text-color: #333;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
width: 320px;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1.5rem;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
text-align: left;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
background: var(--input-bg-color);
|
||||
border: 1px solid var(--input-border-color);
|
||||
border-radius: 8px;
|
||||
color: var(--text-color);
|
||||
font-size: 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
background: var(--button-bg-color);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
color: var(--button-text-color);
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.error {
|
||||
color: #ff8a80;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Login</h1>
|
||||
<form method="POST" action="login.php">
|
||||
<div class="form-group">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" required>
|
||||
</div>
|
||||
<button type="submit">Login</button>
|
||||
<?php if ($error): ?>
|
||||
<p class="error"><?= htmlspecialchars($error) ?></p>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
6
logout.php
Normal file
6
logout.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
session_start();
|
||||
session_destroy();
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
Loading…
x
Reference in New Issue
Block a user