-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheventslist.php
140 lines (119 loc) · 5 KB
/
eventslist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
include 'dbconn.php';
// Query to select data from the events table
$sql = "SELECT eventID, event_title, description, event_date, ppp, event_imagepath FROM events";
$result = $conn->query($sql);
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" sizes="180x180" href="/KF7013/assets/images/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/KF7013/assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/KF7013/assets/images/favicon/favicon-16x16.png">
<link rel="manifest" href="/KF7013/assets/images/favicon/site.webmanifest">
<link rel="mask-icon" href="/KF7013/assets/images/favicon/safari-pinned-tab.svg" color="#5bbad5">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="/KF7013/assets/stylesheets/styles.css" />
<title>Events List - TOONE</title>
</head>
<body>
<!-- this php is for checking logged-in status to enable the navbar as javascript cannot directly access the httponly and secure cookie -->
<?php
session_start();
echo '<script type="text/javascript">';
if (isset($_SESSION['logged-in']) && $_SESSION['logged-in'] === true) {
echo 'var isLoggedIn = true;';
} else {
echo 'var isLoggedIn = false;';
}
echo '</script>';
?>
<header class="header_container">
<!-- Navigation bar -->
<nav class="navbar">
<a href="index.php"><img src="/KF7013/assets/images/logo.png" alt="logo"></a>
<ul class="navbar_list">
</ul>
<div class="burger">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</div>
</nav>
<!-- Hero Section of the Page -->
<div class="hero_section">
<div class="hero_text">
<h1>EVENTS - TOONE</h1>
<p>Check out the latest events taking place at the Toone Park.</p>
</div>
</div>
</header>
<main class="list-container">
<!-- Events List Section -->
<div class="events-container">
<?php
if ($result->num_rows > 0) {
// Loop through each row and display the HTML with data
while($row = $result->fetch_assoc()) {
// Convert the event date to a DateTime
$date = new DateTime($row["event_date"]);
// Format the date as "Month - Date at Time"
$formattedDate = $date->format('F - d \a\t H:i');
?>
<!-- event cards -->
<div class="event-card">
<img src="/KF7013/assets/images/<?php echo $row["event_imagepath"]; ?>" alt="<?php echo $row["event_title"]; ?>" class="event-image">
<div class="event-details">
<h3 class="event-title"><?php echo $row["event_title"]; ?></h3>
<p class="event-desc"><?php echo $row["description"]; ?></p>
<p class="event-time"><?php echo $formattedDate; ?></p>
<p class="event-price">£<?php echo $row["ppp"]; ?></p>
<a href="eventdetails.php?eventID=<?php echo $row['eventID']; ?>"><button>More info</button></a>
</div>
</div>
<?php
}
} else {
echo "0 events found";
}
?>
</div>
<!-- Side Banner Section -->
<aside class="promotion">
<img src="/KF7013/assets/images/rep.webp" alt="Virginia Prize for Fiction" class="event-image">
<img src="/KF7013/assets/images/sidebanner2.webp" alt="Virginia Prize for Fiction" class="event-image">
</aside>
</main>
<!-- Footer -->
<footer class="footer">
<div class="footer-text">
<div class="footer-section">
<h4>Browse</h4>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="eventslist.php">All Events</a></li>
<li><a href="credits.php">Credits</a></li>
</ul>
</div>
<div class="footer-section">
<h4>Address</h4>
<p>The Toone Park, <br>TL7 7AR, <br>Toonland</p>
</div>
<div class="footer-section">
<h4>Contact</h4>
<p>+44 78945 12356 <br> tooneevents@email.com</p>
</div>
</div>
<div class="footer-img">
<a href="index.php"><img src="/KF7013/assets/images/logodark.png" alt="logo"></a>
</div>
</footer>
<script src="/KF7013/assets/scripts/scripts.js"></script>
</body>
</html>
<?php
// Close connection
$conn->close();
?>