-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.php
More file actions
212 lines (184 loc) · 5.76 KB
/
events.php
File metadata and controls
212 lines (184 loc) · 5.76 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?php
session_start();
$creator = $_SESSION['email'];
?>
<head>
<title>Cookzilla</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/icons.css" />
<link href="http://fonts.googleapis.com/css?family=Raleway:400,300,500,600,700,800" rel="stylesheet">
<script src="https://use.fontawesome.com/e808bf9397.js"></script>
<link rel="shortcut icon" href="images/favicon.ico" />
</head>
<body class>
<!--preloader-->
<div class="preloader">
<div class="spinner"></div>
</div>
<!--//preloader-->
<!--header-->
<header class="head" role="banner">
<!--wrap-->
<div class="wrap clearfix">
<a href="index.php" class="logo"><img src="images/ico/logo.png" alt="SocialChef logo" /></a>
<nav class="main-nav" role="navigation" id="menu">
<ul>
<li><a href="index.php" title="Home"><span>Home</span></a></li>
<li><a href="recipes.php" title="Recipes"><span>Recipes</span></a></li>
<li><a href="groups.php" title="Groups"><span>Groups</span></a>
<ul>
<li><a href="create_group.php" title="Create group">Create Group</a></li>
<li><a href="groups.php" title="See group">View Groups</a></li>
</ul>
</li>
<li class="current-menu-item"><a href="events.php" title="Events"><span>Events</span></a>
<ul>
<li><a href="create_event.php" title="Create event">Create Event</a></li>
<li><a href="events.php" title="See group">View Events</a></li>
</ul>
</li>
</ul>
</nav>
<nav class="user-nav" role="navigation">
<ul>
<li class="light"><a href="logout.php" title="Search for recipes"><i class="icon icon-themeenergy_door-hanger"></i> <span>Log out</span></a></li>
<li class="medium"><a href="my_profile.php" title="My account"><i class="icon icon-themeenergy_chef-hat"></i> <span>My account</span></a></li>
<li class="dark"><a href="submit_recipe.php" title="Submit a recipe"><i class="icon icon-themeenergy_fork-spoon"></i> <span>Submit a recipe</span></a></li>
</ul>
</nav>
</div>
<!--//wrap-->
</header>
<!--//header-->
<?php
$host = "localhost";
$user = "root";
$password = "root";
$db = "cookzilla";
$link = mysqli_connect($host, $user, $password);
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit();
}
$database = mysqli_select_db($link, $db);
if (!$database) {
echo "Error: Unable to locate the database.";
exit();
}
$query = "SELECT * FROM events";
$result = mysqli_query($link, $query);
mysqli_close($link);
?>
<?php if ($_SESSION['loggedin']): ?>
<!--main-->
<main class="main" role="main">
<!--wrap-->
<div class="wrap clearfix">
<!--row-->
<div class="row">
<header class="s-title">
<h1>Events</h1>
</header>
<!--content-->
<section class="content full-width">
<!--entries-->
<div class="entries row">
<?php
while ($row = mysqli_fetch_assoc($result)) {
?>
<?php
$groupname = $row['eid'];
$href = "event.php?eid=";
$combined = $href . $groupname;
?>
<!--item-->
<div class="entry one-fourth">
<figure>
<img src="images/cooking2.jpg" alt="" />
<figcaption><a href=<?php echo $combined?>><i class="icon icon-themeenergy_eye2"></i> <span>View event</span></a></figcaption>
</figure>
<div class="container">
<h2><a href=href=<?php echo $combined?>><?php echo $row['eventname'] ?></a></h2>
</div>
</div>
<!--item-->
<?php
}
?>
<div class="quicklinks">
<a href="javascript:void(0)" class="button scroll-to-top">Back to top</a>
</div>
</div>
<!--//entries-->
</section>
<!--//content-->
</div>
<!--//row-->
</div>
<!--//wrap-->
</main>
<!--//main-->
<?php else : ?>
<!--main-->
<main class="main" role="main">
<!--wrap-->
<div class="wrap clearfix">
<!--row-->
<div class="row">
<!--content-->
<section class="content three-fourth">
<!--row-->
<div class="row">
<div class="two-third">
<div class="container">
<p>Only members can see events.</p>
<p>Click <a href=login.php>here</a> to log in. </p>
</div>
</div>
</div>
<!--//row-->
</section>
<!--//content-->
</div>
<!--//row-->
</div>
<!--//wrap-->
</main>
<!--//main-->
<?php endif; ?>
<!--footer-->
<footer class="foot" role="contentinfo">
<div class="wrap clearfix">
<div class="row">
<article class="one-half">
<h5>About Cookzilla</h5>
<p>Cookzilla is a site that allows people to post cooking recipes, to review and grade posted cooking recipes, to attach additional suggestions to a posted recipe, to organize cooking meetings with other users.</p>
</article>
<article class="one-fourth">
<h5>Need help?</h5>
<p>Contact us via phone or email</p>
<p><em>T:</em> +1 917 868 2306<br /><em>E:</em> <a href="#">adrianxu.ny@gmail.com</a></p>
</article>
<article class="one-fourth">
<h5>Follow us</h5>
<ul class="social">
<li><a href="#" title="facebook"><i class="fa fa-fw fa-facebook"></i></a></li>
<li><a href="#" title="youtube"><i class="fa fa-fw fa-youtube"></i></a></li>
<li><a href="#" title="twitter"><i class="fa fa-fw fa-twitter"></i></a></li>
</ul>
</article>
<div class="bottom">
<p class="copy">Copyright 2016 Cookzilla. All rights reserved</p>
</div>
</div>
</div>
</footer>
<!--//footer-->
<script src="js/jquery-3.1.0.min.js"></script>
<script src="js/jquery.uniform.min.js"></script>
<script src="js/jquery.slicknav.min.js"></script>
<script src="js/scripts.js"></script>
</body>
</html>