-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomepage.php
146 lines (138 loc) · 5.88 KB
/
homepage.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
141
142
143
144
145
146
<?php
require('connect.php');
session_start();
if (!isset($_SESSION['email'])) {
header('location:signin.html'); //if user is not logined redirect user to signin
}
$events = [];
$sql = "SELECT events.*, accounts.profile_image, accounts.rating , count(eg.eventID) as total_reg FROM `events` INNER JOIN accounts on events.username = accounts.email left JOIN eventRegistrations eg on eg.eventID =events.eventID GROUP BY events.eventID, accounts.profile_image, accounts.rating"; //select all events with organization
$res = $conn->prepare($sql);
$res->execute();
$events = $res->get_result();
?>
<!DOCTYPE html>
<html>
<head>
<title>Homepage</title>
<link rel="stylesheet" href="css\homepage.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter">
<link rel="stylesheet" href="css\MainNavbar.css">
</head>
<body>
<?php
require 'connect.php';
session_start();
$email = $_SESSION['email'];
$getall = mysqli_query($conn, "SELECT profile_image,rating,userType,name FROM accounts WHERE email='$email'");
$rows = mysqli_fetch_array($getall);
$img = $rows['profile_image'];
$rating = $rows['rating'];
$role = $rows['userType'];
$name = $rows['name'];
?>
<div class="banner">
<header>
<div class="wrapper">
<div class="logo">
<img src="Images/Helping Hands Logo.png" alt="Helping Hands Logo" style="margin-right:1vw;margin-top:1.75vh;" class="imgleft">
<div class="logo-title">
<a href="homepage.php"> HELPING <span class="multicolorlogo">HANDS</span></a>
</div>
</div>
<div class="searchbar">
<input type="text" id="searchInput" placeholder="Search" oninput="search()">
</div>
<nav>
<a href="#">Settings</a>
<div class="dropdown">
<a class="dropa">Notifications
<i class="fa fa-caret-down"></i>
</a>
<script src = "js/fetchNotifs.js"></script>
<div class="dropdown-content">
<!--
<a href="#">Linky1</a>
<a href="#">Linky2</a>
<a href="#">Linky3</a>
<a href="#">Linky4</a>
-->
</div>
</nav>
<div class="profile">
<img src="uploaded/<?php echo $img ?>" alt="<?php echo $img ?>" style="border-radius:50vw;margin-top:1vh; cursor:pointer;" class="profilepic" onclick="redirectToPage('<?php echo $role; ?>')">
<div class="behindpfp">
<?php echo htmlspecialchars_decode($rating) ?>
</div>
<div class="activedot"></div>
</div>
</header>
</div>
<?php
while ($event = $events->fetch_assoc()) {
?>
<div class="post-body">
<post-header>
<div class="post-wrapper">
<div class="post-logo">
<img src="uploaded/<?php echo $event['profile_image']; ?>" alts="Weld Food Bank Logo" class="logocenter">
</div>
<a href="#">...</a>
</div>
</post-header>
<div class="post-rating">
<p>
<?php echo $event['rating']; ?>
</p>
</div>
<div class="post-description">
<p>
<?php echo $event['description']; ?>
</p>
</div>
<post-infomatics>
<img src="Images/calendar.png" alts="Calendar" class="post-infomatics-images">
<div class="date">
<a><?php echo date('M d, Y', strtotime($event['startDate'])); ?> - <?php echo date('M d, Y', strtotime($event['endDate'])); ?></a>
</div>
<img src="Images/clock-png-25767.png" alts="Clock" class="post-infomatics-images">
<div class="time">
<a><span><?php echo date('ha', strtotime($event['startTime'])); ?> - <?php echo date('ha', strtotime($event['endTime'])); ?></span></a>
</div>
<img src="Images/people.png" alts="Five Stick figure torsos and heads" class="post-infomatics-images">
<div class="participants">
<a><?php echo $event['total_reg'] . '/' . $event['volunteersRequired'] ?></a>
</div>
</post-infomatics>
<img src="<?php echo $event['image']; ?>" alt="<?php echo $event['titles']; ?>" class="imagecenter" style="max-width: 40vw">
<form method="POST" action="registerEvent.php">
<input type="hidden" id="user" name="user" value="<?php echo $email; ?>">
<input name="eventID" type="hidden" value="<?php echo $event['eventID']; ?>">
<button class="post-register" type="submit">Register!</button>
</form>
<form action="bookmarkEvent.php" method="POST">
<input type="hidden" id="user" name="user" value="<?php echo $email; ?>">
<input type="hidden" id="<?php echo $eventID; ?>" name="eventID" value="<?php echo $eventID; ?>">
<button class="post-save" type="submit" id="bookmarkEvent">Save for later</button>
</form>
<div class="post-warnings">
<img src="Images/673px-Wheelchair_symbol.svg.png" alts="Disabled Symbol" class="warningimages">
<img src="Images/No_Smoking.svg.png" alts="No Smoking Symbol" class="warningimages">
<img src="Images/HeavyLifting.png" alts="Stick figure lifing heavy box" class="warningimages">
</div>
</div>
<?php } ?>
<body>
<?php
if (isset($_SESSION['flash'])) { //check flah message
?>
<script>
alert("<?php echo $_SESSION['flash']; ?>")
</script>
<?php
unset($_SESSION['flash']); //unset flash message
} ?>
</html>
<script src="js/redirect.js"></script>
<script src="js/search.js"></script>
</body>
</html>