initial commit
This commit is contained in:
46
index.php
Executable file
46
index.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
include('inc/check_login.php');
|
||||
include('inc/db.php');
|
||||
include('inc/head.php');
|
||||
|
||||
// Aktuelle Kalenderwoche berechnen
|
||||
$current_week = date('W');
|
||||
|
||||
// SQL-Abfrage mit JOIN zwischen meetings und colors
|
||||
$sql = "SELECT * FROM meetings
|
||||
JOIN colors ON meetings.color_id = colors.id
|
||||
WHERE WEEK(meeting_date, 1) = $current_week
|
||||
ORDER BY meeting_date DESC LIMIT 1";
|
||||
|
||||
$result = mysqli_query($conn, $sql);
|
||||
if (!$result) {
|
||||
die("Fehler in der SQL-Abfrage: " . mysqli_error($conn));
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
?>
|
||||
|
||||
<div class="container py-5">
|
||||
<div class="text-center mb-5">
|
||||
<h1 class="display-4 fw-bold">DoMiLi</h1>
|
||||
<p class="lead">Farbe der Kalenderwoche <strong><?= $current_week ?></strong></p>
|
||||
</div>
|
||||
|
||||
<?php if ($row): ?>
|
||||
<div class="card mx-auto bg-light shadow" style="max-width: 300px;">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title mb-3">Farbe der Woche</h5>
|
||||
<div class="rounded mb-3 mx-auto" style="width: min(100px, 25vw); height: min(100px, 25vw); background-color: <?= htmlspecialchars($row['hex_code']) ?>;"></div>
|
||||
<p class="fs-5 fw-semibold"><?= htmlspecialchars($row['name']) ?></p>
|
||||
<p class="text-muted">Datum: <?= date('d.m.Y', strtotime($row['meeting_date'])) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-warning text-center">
|
||||
Keine Farbe für diese Woche festgelegt.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include('inc/footer.php'); ?>
|
||||
Reference in New Issue
Block a user