<?php include_once '../database/connection.php'; include_once '../database/users.php'; include_once '../database/events.php'; $title = "My registered events"; include_once '../templates/header.php'; if (!isset($_SESSION['userId'])) { header('Location: ../index.php'); } $result = getRegisteredEvents($_SESSION['userId']); include_once '../templates/event_list.php'; include_once '../templates/footer.php';
<?php $username = $_SESSION['user']; $userid = getAccountid($username); $eventlist = ""; $eventname = ""; $upcoming = ""; $ongoing = ""; $registered = ""; $events = array(); $categories = array(); $news = array(); $timezone = "Asia/Calcutta"; date_default_timezone_set($timezone); $eventlist = getRegisteredEvents($userid); for ($i = 0; $i < count($eventlist); $i++) { $eventname = getEventbyid($eventlist[$i]['event_id']); $registered .= "<tr>\n\t\t\t <td><p style='padding:3px; line-height:20px;'>{$eventname[0]['event_name']}</p></td>\n\t\t\t <td><p style='padding:3px; line-height:20px;'>" . format_date($eventname[0]['start']) . "</p></td>\n\t\t\t <td><p style='padding:3px; line-height:20px;'>" . format_date($eventname[0]['end']) . "</p></td>\n\t\t </tr>\n\t "; } $categories = getEventCategories(); $events = getAllEvents(); for ($i = 0; $i < count($categories); $i++) { $eventcat = $categories[$i]['id']; for ($j = 0; $j < count($events); $j++) { if ($eventcat == $events[$j]['event_category_id']) { if (strtotime($events[$j]['start']) <= time() && time() < strtotime($events[$j]['end'])) { $ongoing .= "<tr><td>{$events[$j]['event_name']}</td><td>" . ucFirst($categories[$i]['name']) . "</td><td>" . format_date($events[$j]['end']) . "</td></tr>"; } } } }