-
Notifications
You must be signed in to change notification settings - Fork 1
/
broadcast.php
executable file
·297 lines (256 loc) · 12.1 KB
/
broadcast.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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<?php
session_start();
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
include_once('dbConfig.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CSED notice board</title>
<link rel="icon" href="img/logo.jpg">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="css/custom.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/scroll.css">
<style>
body {
background-image: url("img/Quill_pen.jpg");
background-size: cover;
}
</style>
<script src="js/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#div1").fadeOut(3000);
});
</script>
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="#" class="site_title"><i class="fa fa-book"></i> <span>CSED notice</span></a>
</div>
<!-- menu profile quick info -->
<div class="profile clearfix">
<div class="profile_pic">
<img src="img/face.jpg" alt="..." class="img-circle profile_img">
</div>
<div class="profile_info">
<span>Welcome,</span>
<!-- logged in user information -->
<?php if (isset($_SESSION['username'])) : ?>
<h2><?php echo $_SESSION['username']; ?></h2>
<?php endif ?>
</div>
</div>
<!-- /menu profile quick info -->
<br/>
<!-- sidebar menu -->
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li><a href="index.php"><i class="fa fa-home"></i> Home <span class="fa fa-chevron-down"></span></a></li>
<li data-toggle="modal" data-target="#add_blog_modal"><a>
<i class="fa fa-edit"></i><span class="fa fa-chevron-down"></span>Create a new event</a></li>
<li><a href="calender.php"><i class="fa fa-calendar"></i> Event Calender <span class="fa fa-chevron-down"></span></a></li>
<li><a href="broadcast.php"><i class="fa fa-table"></i> Broadcast <span class="fa fa-chevron-down"></span></a></li>
<li><a href="joined.php"><i class="fa fa-user-circle-o"></i> Joined <span class="fa fa-chevron-down"></span></a></li>
<?php
if ($_SESSION["username"] === 'Admin')
{
?>
<li><a href="admin.php"><i class="fa fa-calendar-plus-o"></i> Approve the events <span class="fa fa-chevron-down"></span></a></li>
<?php
}
?>
</ul>
</div>
</div>
</div>
</div>
<!-- top navigation -->
<div class="top_nav">
<div class="nav_menu">
<nav>
<div class="nav toggle">
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="img/face.jpg" alt="">
<!-- logged in user information -->
<?php if (isset($_SESSION['username'])) : ?>
<?php echo $_SESSION['username']; ?>
<?php endif ?>
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu pull-right">
<li><a href="index.php?logout='1'"><i class="fa fa-sign-out pull-right"></i> Log Out</a></li>
</ul>
</li>
<li role="presentation" class="dropdown">
<a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown"
aria-expanded="false">
<i class="fa fa-envelope-o"></i>
<span class="badge bg-green">6</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
<!-- /top navigation -->
<!-- page content area main -->
<div class="right_col">
<div class="title_left">
<h3>CSED Notice Board</h3>
</div>
<!-- notification message -->
<?php if (isset($_SESSION['success'])) : ?>
<div id="div1">
<h2>
<?php
echo $_SESSION['success'];
unset($_SESSION['success']);
?>
</h2>
</div>
<?php endif ?>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="output_scroll">
<prescroll>
<table class="table table-bordered">
<th>Event name</th>
<th>Event Description</th>
<th>Venue</th>
<th>Date</th>
<th>Time</th>
<th>Status</th>
<?php
$dat = date("Y-m-d");
$query = "select * from event where event_date >= '$dat' order by event_date asc";
$res=mysqli_query($db,$query);
while ($row = mysqli_fetch_array($res))
{
$query2 = "select status2 from eventJoin where username='$_SESSION[username]' and event_id='$row[event_id]'";
$res2=mysqli_query($db,$query2);
$row2 = mysqli_fetch_array($res2);
if ($row["status1"] === 'Approved')
{
echo "<tr>";
echo "<td>";
echo $row["event_name"];
echo "</td>";
echo "<td class='next_line_word'>";
echo $row["event_desc"];
echo "</td>";
echo "<td>";
echo $row["venue"];
echo "</td>";
echo "<td>";
echo $row["event_date"];
echo "</td>";
echo "<td>";
echo $row["time"];
echo "</td>";
echo "<td>";
if( $row2['status2'] === 'Joined')
{
echo $row2['status2'];
}
else
{
?>
<form action="server.php" method="post">
<input type="hidden" name="joinId" <?php echo "value='".$row["event_id"]."'" ?> >
<input type="hidden" name="joinUser" <?php echo "value='".$_SESSION["username"]."'" ?> >
<button type="submit" name="join11" class="btn btn-primary btn-md">Join</button>
</form>
<?php
echo "</td>";
echo "</tr>";
}
}
}
?>
</table>
</prescroll>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<!-- Modal -->
<div id="add_blog_modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add a new Event</h4>
</div>
<div class="modal-body">
<form method="post" action="server.php">
<div class="form-group">
<label>Title</label>
<input type="text" name="title" class="form-control" id="title">
</div>
<div class="form-group">
<label>Description of the event</label>
<textarea type="text" rows="6" name="comments" class="form-control" id="content"></textarea>
</div>
<div class="form-group">
<label>Venue of the event</label>
<input type="text" name="venue" class="form-control"></input>
</div>
<div class="form-group">
<label>Date for the event</label>
<input type="date" name="date1" class="form-control"></input>
</div>
<div class="form-group">
<label>Time of the event</label>
<input type="time" name="time1" class="form-control"></input>
</div>
<button type="submit" name="commented" class="btn btn-default">Submit</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- END MODAL -->
</div>
</div>
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="js/fastclick.js"></script>
<!-- NProgress -->
<script src="js/nprogress.js"></script>
<!-- Custom Theme Scripts -->
<script src="js/custom.min.js"></script>
</body>
</html>