-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCoursePage.php
More file actions
709 lines (659 loc) · 28.7 KB
/
CoursePage.php
File metadata and controls
709 lines (659 loc) · 28.7 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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<?php
session_start();
error_reporting(E_ERROR | E_PARSE);
// If the session vars aren't set, try to set them with a cookie
if (!isset($_SESSION['user_id'])) {
if (isset($_COOKIE['user_id']) && isset($_COOKIE['username'])) {
$_SESSION['user_id'] = $_COOKIE['user_id'];
$_SESSION['username'] = $_COOKIE['username'];
}
}
?>
<html>
<head>
<title> DataBase Systems </title>
<head>
<!-- media queries -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="navbar_scripts.js"></script>
<link rel="stylesheet" type="text/css" href="css/animate.css">
<!-- Normalize -->
<link rel="stylesheet" type="text/css" href="css/cardio.css">
<link rel="stylesheet" type="text/css" href="stylesheet1.css">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111996482-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-111996482-1');
</script>
<style type="text/css">
@import "http://fonts.googleapis.com/css?family=Raleway";
#my_div {
width:100%;
height:100%;
opacity:.95;
top:0;
left:0;
display:none;
position:fixed;
background-color:#313131;
overflow:auto;
z-index: 1000;
}
#my_div1 {
width:100%;
height:100%;
opacity:.95;
top:0;
left:0;
display:none;
position:fixed;
background-color:#313131;
overflow:auto;
z-index: 1000;
}
div#my_popup {
position:absolute;
left:50%;
top:200%;
align-content: center;
overflow: visible;
margin-left:-202px;
font-family:'Raleway',sans-serif
}
form#fupForm {
max-width:300px;
min-width:250px;
padding:10px 50px;
border:2px solid gray;
border-radius:10px;
font-family:raleway;
background-color:#fff;
margin-left: 40%;
margin-top:20%;
}
form#URLForm {
max-width:300px;
min-width:250px;
padding:10px 50px;
border:2px solid gray;
border-radius:10px;
font-family:raleway;
background-color:#fff;
margin-left: 40%;
margin-top:20%;
}
.sortable {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
border:0px;
width: 100%;
color:#222222;
}
.sortable tr:nth-child(even){background-color: #f2f2f2;}
.sortable tr:hover {background-color: #ddd;}
.sortable td, .sortable th {
border: 1px solid #ddd;
padding: 8px;
color: #222222;
}
.sortable th {
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
background-color: #222222;
color: white;
}
.headers{
padding-left: 5%;
padding-right: 5%;
opacity: 0.9;
}
.tableContainer{
background-color: #f5f2f1;
border-radius: 0px 0px 5px 5px;
margin-left: 2%;
margin-right: 2%;
padding: 2%
}
.headers >h3{
margin-bottom: 0px;
}
.comment{
opacity: 0.9;
background-color: #303030;
}
.comment > p{
margin-bottom: 3px;
}
</style>
</head>
<?php
require_once('connectvars.php');
// Start the session
session_start();
// Clear the error message
$error_msg = "";
// If the user isn't logged in, try to log them in
if (!isset($_SESSION['user_id'])) {
if (isset($_POST['submit'])) {
// Connect to the database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
// Grab the user-entered log-in data
$user_username = mysqli_real_escape_string($dbc, trim($_POST['username']));
$user_password = mysqli_real_escape_string($dbc, trim($_POST['password']));
if (!empty($user_username) && !empty($user_password)) {
// Look up the username and password in the database
$query = "SELECT user_id, username FROM users WHERE username = '$user_username' AND password = SHA('$user_password')";
$data = mysqli_query($dbc, $query);
if (mysqli_num_rows($data) == 1) {
// The log-in is OK so set the user ID and username session vars (and cookies), and redirect to the home page
$row = mysqli_fetch_array($data);
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['username'] = $row['username'];
setcookie('user_id', $row['user_id'], time() + (60 * 60 * 24 * 30)); // expires in 30 days
setcookie('username', $row['username'], time() + (60 * 60 * 24 * 30)); // expires in 30 days
// Redirect to the home page
$home_url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/home.php';
}
else {
// The username/password are incorrect so set an error message
//<h5 style = 'color:white; margin-top:1cm; margin-bottom:-2cm; float:right'>Sorry, you must enter a valid username and password to log in.</h5>
echo "<script>alert('Sorry, you must enter a valid username and password to log in');</script>";
}
}
else {
// The username/password weren't entered so set an error message
echo "<span style = 'color:white; margin-top:3cm;'>Sorry, you must enter your username and password to log in.</span>";
}
}
}
?>
<script>
$(document).ready(function(){
$("div.headers h3").click(function(){
console.log("asdasd");
$(this).siblings("*").not("h3").toggle();
});
/* $("input[type='button']").click(function(e){
e.preventDefault();
return false;
});
*/
$('table').DataTable( {
fixedHeader: true
} );
$("#courseProgress");
$("#linkProgress");
});
</script>
<body onload = "typeWriter()">
<section id="team" class="section gray-bg" style="background-image:url(b1.jpg); background-size:cover;";">
<!-- Nav Bar -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<img src = "logo.png" width = "40px" height = "40px" id = "imm">
<button id="navbarCollapseButton" type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li ><a href="home.php"><span class="glyphicon glyphicon-home" aria-hidden="true"></span><b>  Home</b></a></li>
<li class = "dropdown">
<a href="#intro" class="dropdown-toggle" data-toggle="dropdown" style="color:white;">Schools</a>
<ul class="dropdown-menu" style="background-color:black">
<li class="dropdown dropdown-submenu" >
<a href="course1.php" target="null" class="dropdown-toggle" data-toggle="dropdown" style="color:grey;">Seecs</a>
<ul class = "dropdown-menu" style="background-color:black;">
<li><a href="course1.php" target="null" style="color:grey;">Software Engineering</a></li>
<li><a href="course1.php" target="null" style="color:grey;">Electrical Engineering</a></li>
<li><a href="course1.php" target="null" style="color:grey;">Computer Science</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu" >
<a href="course1.php" target="null" class="dropdown-toggle" data-toggle="dropdown" style="color:grey;">Nbs</a>
<ul class = "dropdown-menu" style="background-color:black;">
<li><a href="course1.php" target="null" style="color:grey;">BBA</a></li>
<li><a href="course1.php" target="null" style="color:grey;">MBA</a></li>
<li><a href="course1.php" target="null"style="color:grey;">ACF</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu" >
<a href="course1.php" target="null" class="dropdown-toggle" data-toggle="dropdown" style="color:grey;">SMME</a>
<ul class = "dropdown-menu" style="background-color:black;">
<li><a href="course1.php" target="null" style="color:grey;">Mechanical Engineering</a></li>
<li><a href="course1.php" target="null" style="color:grey;">Megatronic Engineering</a></li>
<li><a href="course1.php" target="null"style="color:grey;">Material Engineering</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu" >
<a href="course1.php" target="null" class="dropdown-toggle" data-toggle="dropdown" style="color:grey;">NICE</a>
<ul class = "dropdown-menu" style="background-color:black;">
<li><a href="course1.php" target="null" style="color:grey;">Civil Engineering</a></li>
<li><a href="course1.php" target="null" style="color:grey;">Road Engineering</a></li>
<li><a href="course1.php" target="null"style="color:grey;">Info Engineering</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu" >
<a href="course1.php" target="null" class="dropdown-toggle" data-toggle="dropdown" style="color:grey;">SNS</a>
<ul class = "dropdown-menu" style="background-color:black;">
<li><a href="course1.php" target="null" style="color:grey;">Physics</a></li>
<li><a href="course1.php" target="null" style="color:grey;">Maths</a></li>
<li><a href="course1.php" target="null"style="color:grey;">Fluid Physics</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu" >
<a href="course1.php" target="null" class="dropdown-toggle" data-toggle="dropdown" style="color:grey;">SCME</a>
</li>
<li class="dropdown dropdown-submenu" >
<a href="course1.php" target="null" class="dropdown-toggle" data-toggle="dropdown" style="color:grey;">S3H</a>
</li>
</ul>
</li>
<li><a href="about.php">News Portal</a></li>
</ul><!-- Login Button !-->
<ul class="nav navbar-nav navbar-right">
<li>
<ul class="nav">
<li>
<form id="searchContainer">
<input list="list" id="name" placeholder="Search.." class="search" onclick="search()">
<datalist id="list">
</datalist>
</form>
</li>
<li>
<button style="margin:0px;margin:12px 0px 12px 0px ;padding: 0px;" class="searchGo">>> </button>
 
</li>
</ul>
</li><?php if (isset($_SESSION['username'])){ ?>
<li><span class="glyphicon glyphicon-edit" style = "color:white; margin-top: .5cm;"></span>
<a href="viewprofile.php" style="margin-top: -.75cm; color:white;"><?php echo ' '.strtoupper($_SESSION['username']).''; ?>
</li>
<?php } else {?>
<li><a data-toggle="modal" data-target="#signupModal"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
<li><a data-toggle="modal" data-target="#loginModal"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
<?php } ?>
</ul>
</div>
</div>
</nav>
<!-- Login Form !-->
<div id="loginModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"> ×</button>
<h3><b>Login<b></h3sss>
</div>
<div class="modal-body">
<!-- Form for collection of data from the sign-up form -->
<form class="form-inline" method = 'post' action = ''>
<div class="form-group">
<label class="sr-only" for="email">Username</label>
<input type="text" class="form-control input-sm" placeholder="username" id="username" name="username" required>
</div>
<div class="form-group">
<label class="sr-only" for="password" >Password</label>
<input type="password" class="form-control input-sm" placeholder="Password" id="password" name="password" required>
</div>
<input type="submit" value = "Sign in" name = "submit" class="btn btn-info btn-xs">
</Br></Br>
<div class="checkbox">
<label>
<input type="checkbox" id = "rememberme" name = "rememberme"> Remember me
</label><br><br>
<div align="center" class="fb-login-button" data-max-rows="1" data-size="small" data-button-type="continue_with" data-show-faces="false" data-auto-logout-link="false" data-use-continue-as="false"></div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- SignUp Form !-->
<?php
require_once('appvars.php');
require_once('connectvars.php');
// Connect to the database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (isset($_POST['submit'])) {
// Grab the profile data from the POST
$username = mysqli_real_escape_string($dbc, trim($_POST['username1']));
$password1 = mysqli_real_escape_string($dbc, trim($_POST['password1']));
$password2 = mysqli_real_escape_string($dbc, trim($_POST['repassword']));
$email = mysqli_real_escape_string($dbc, trim($_POST['email']));
$fname = mysqli_real_escape_string($dbc, trim($_POST['fname']));
$lname = mysqli_real_escape_string($dbc, trim($_POST['lname']));
if (!empty($username) && !empty($password1) && !empty($password2) && ($password1 == $password2) && (!empty($email)) && (!empty($fname)) && (!empty($lname)) ) {
// Make sure someone isn't already registered using this username
$query = "SELECT * FROM users WHERE username = '$username'";
$data = mysqli_query($dbc, $query);
if (mysqli_num_rows($data) == 0) {
// The username is unique, so insert the data into the database
$query = "INSERT INTO users (username, password, join_date, first_name, last_name, email) VALUES ('$username', SHA('$password1'), NOW(), '$fname', '$lname', '$email')";
mysqli_query($dbc, $query);
// Confirm success with the user
echo '<p>Your new account has been successfully created. You\'re now ready to <a href="login.php">log in</a>.</p>';
mysqli_close($dbc);
}
else {
// An account already exists for this username, so display an error message
echo '<p class="error">An account already exists for this username. Please use a different address.</p>';
$username = "";
}
}
else {
echo '<p class="error">You must enter all of the sign-up data, including the desired password twice.</p>';
}
}
mysqli_close($dbc);
?>
<div id="signupModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"> ×</button>
<h3><b>Sign Up</b></h3>
</div>
<div class="modal-body">
<form class="form-inline" method="post" action="">
<h5>
<div class="form-group" id = "fn">
<b>Name</b>
<label class="sr-only" for="fname">First Name</label>
<input type="text" class="form-control input-sm" placeholder="First Name" id="fname" name="fname" required>
</div>
<div class="form-group" id ="ln">
<label class="sr-only" for="lname">Last Name</label>
<input type="text" class="form-control input-sm" placeholder="Last Name" id="lname" name="lname">
</div>
</h5>
</Br>
</Br>
<h5>
<div class="form-group" style="margin-left: 0cm">
<b>Username</b>
<label class="sr-only" for="username1">Username</label>
<input type="text" class="form-control input-sm" placeholder="username" id="username1" name="username1" required>
 
<a href="#" data-toggle="tooltip" title="No spaces should be included">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true">
</span>
</a>
</div>
</h5>
</Br>
</Br>
<div class="form-group" id = "em">
<h5>
<b>E-mail</b>
<label class="sr-only" for="email">Email</label>
<input type="text" class="form-control input-sm" placeholder="Email" id="email" name="email" required>
</h5>
</div>
</Br>
</Br>
<h5>
<div class="form-group" id = "pw">
<b>Pasword</b>
<label class="sr-only" for="password1" >Password</label>
<input type="password" class="form-control input-sm" placeholder="Password" id="password1" name="password1" onkeyup = "func_p()" required>
</div>
<div class="form-group">
<label class="sr-only" for="repassword" style="margin-left: 0cm">Re-Enter Password</label>
<input type="password" class="form-control input-sm" placeholder="Re-Enter Password" id="repassword" name="repassword" onkeyup = "pass_match()" required>
</div>
</h5>
</Br>
<p id = "demo1" style= "display:inline; margin-left: 1.7cm;"></p>
<p style= "display:inline; margin-left: 0cm" id = "demo"></p>
<p style= "display:inline; margin-left: 2.5cm; color:red" id = "demo2"></p>
<p style= "display:inline; margin-left: 2.5cm; color:blue" id = "demo3"></p>
</Br></Br>
<div class="form-group">
<input type="checkbox" id="accept-terms">
<label for="accept-terms">I agree to the
<a href="#" title="User Terms and Conditions" data-toggle="popover" data-placement="right" data-content="Personal information collection
Using personal information
Securing your data
Cross-border data transfers
Updating this statement
Other websites
Contact
This privacy statement">Terms</a>
</label>
<div class="g-recaptcha" data-sitekey="6Lfcoj8UAAAAAF9XCT-RWY4Dm_dHTi3iYZYreEzm"></div>
</div>
</div>
</Br></Br>
<input type="submit" name = "submit" value = "Sign Up" class="btn btn-info btn-xs">
<div align="center" class="fb-login-button" data-max-rows="1" data-size="large" data-button-type="continue_with" data-show-faces="false" data-auto-logout-link="false" data-use-continue-as="false"></div>
</Br>
</Br>
</form>
</div>
</div>
</div>
</div>
<div style="position: relative;">
<h2 style="text-align:left; padding-top:2cm; padding-left: 1cm;">DATABASE SYSTEMS</h2>
<a href='download.php' style="float: right;">Download All Material</a>
</div>
<p> Insert course description here.</p>
<div class="headers"><h3>Course Outline</h3>
<ul style="list-style:none;">
<li>alpha</li>
<li>beta</li>
</ul>
</div>
<div class="headers" ><h3>Course Work</h3>
<div class="tableContainer">
<?php if (isset($_SESSION['username'])){ ?>
<!-- code -->
<div id="my_div" style="display: none;">
<div id="popupContact">
<form enctype="multipart/form-data" id="fupForm" >
<div class="form-group">
<label for="file">File</label>
<input type="file" class="form-control" id="file" name="file" required />
</div>
<input type="submit" name="submit" class="btn btn-danger submitBtn" value="SAVE"/>
<progress id="courseProgress" value="0" max="100"></progress>
<p class="statusMsg"></p>
<button onclick="div_hide()">Close</button>
</form>
</div>
</div>
<button onclick="div_show()" style="float: right;">Upload File</button>
<!-- end -->
<?php } ?>
<table class="sortable">
<thead style="color:black;background-color: white;">
<tr>
<th style="padding: 0px;width:30px;">ID</th>
<th>Title</th>
<th>Uploader</th>
<th>Time</th>
<?php if (isset($_SESSION['username'])){ ?>
<?php if ($_SESSION['username']=='admin'){ ?>
<th style="padding: 0px;width:40px;"><span class="glyphicon glyphicon-thumbs-up"></span></th>
<?php } ?>
<th style="padding: 0px;width:40px;"><span class="glyphicon glyphicon-Trash"></span></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$mysqli = new mysqli("localhost", "root", "", "linust_f");
$result = $mysqli->query("SELECT * FROM file_upload as f1 NATURAL JOIN users as u1 WHERE f1.course_name='dbs' AND f1.status=1;");
//u1.fname,u1.lname,u1.username,f1.file_id,f1.file_name,f1.f_date,f1.status
// look through query
while($row = $result->fetch_assoc()){
echo "<tr>";
echo "<td>";
echo $row['file_id'];
echo "</td>";
$variable=" '/uploads/".$row['file_name']."'";
echo "<td><a href=$variable download>";
echo $row['file_name'];
echo "</a></td>";
echo "<td>";
echo $row['first_name'].' '.$row['last_name'].' ('.$row['username'].')';
echo "</td>";
echo "<td>";
echo $row['f_date'];
echo "</td>";
if (isset($_SESSION['username'])){
echo "<td>";
if($_SESSION['username']==$row['username']){
echo '<a href="delete.php?id='.$row['file_id'].'&type=CourseWork"><span class="glyphicon glyphicon-remove"></span></a>';
}
echo "</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
<div class="headers" ><h3>Related links</h3>
<div class="tableContainer">
<?php if (isset($_SESSION['username'])){ ?>
<div id="my_div1" style="display: none;">
<div id="popupContact">
<form enctype="multipart/form-data" id="URLForm" >
<div class="form-group">
<label for="url">File</label>
<input type="text" class="form-control" id="url" name="url" />
</div>
<input type="submit" name="submit" class="btn btn-danger submitBtn" value="SAVE"/>
<progress id="linkProgress" value="0" max="100"></progress>
<p class="statusMsg1"></p>
<button onclick="div_hide1()">Close</button>
</form>
</div>
</div>
<button onclick="div_show1()" style="float: right;">Upload URL</button>
<?php } ?>
<table class="sortable">
<thead style="color:black;background-color: white;">
<tr>
<th style="padding: 0px;width:30px;">ID</th>
<th>Link</th>
<th>Uploader</th>
<th>Time</th>
<?php if (isset($_SESSION['username'])){ ?>
<th style="padding: 0px;width:40px;"><span class="glyphicon glyphicon-Trash"></span></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$mysqli = new mysqli("localhost", "root", "", "linust_f");
$result = $mysqli->query("SELECT * FROM url_upload as f1 NATURAL JOIN users as u1 WHERE f1.course_name='dbs' AND f1.status=1;");
while($row = $result->fetch_assoc()){
echo "<tr>";
echo "<td>";
echo $row['url_id'];
echo "</td>";
echo "<td>";
echo $row['url_link'];
echo "</td>";
echo "<td>";
echo $row['first_name'].' '.$row['last_name'].' ('.$row['username'].')';
echo "</td>";
echo "<td>";
echo $row['u_date'];
echo "</td>";
if (isset($_SESSION['username'])){
echo "<td>";
if($row['status']==0){
echo '<a href="approve.php?id='.$row['url_id'].'&type=RelatedLink"><span class="glyphicon glyphicon-ok"></span></a>';
}
echo "</td>";
echo "<td>";
if($_SESSION['username']==$row['username']){
echo '<a href="delete.php?id='.$row['url_id'].'&type=RelatedLink"><span class="glyphicon glyphicon-remove"></span></a>';
}
echo "</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
<div class="headers">
<h3>Comments:</h3>
<div class="modal-body">
<!-- Form for collection of data from the sign-up form -->
<?php
$mysqli = new mysqli("localhost", "root", "", "linust_f");
$result = $mysqli->query("SELECT * FROM comments NATURAL JOIN users WHERE course_name='dbs';");
while($row = $result->fetch_assoc()){
echo "<div class=comment>";
echo "<p class=username>";
echo $row['first_name'].' '.$row['last_name'].' ('.$row['username'].')';
echo "</p>";
echo "<p class=commenttext>";
echo $row['comment'];
echo "</p>";
echo "<p class=time>";
echo $row['c_date'];
echo "</p>";
echo "</div>";
}
?>
<form class="form-inline" id="commentForm" method = 'post' action = 'submit_comment.php'>
<div class="form-group">
<label class="sr-only">Comment</label>
<input type="text" class="form-control input-sm" placeholder="Comment" id="Comment" name="Comment">
</div>
</Br></Br>
<button type="submit" id="commentSubmit" class="btn btn-info btn-xs">Submit</button>
</form>
</div>
</div>
</div>
<div align="center">
<video width="60%" controls>
<source src="data.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</body>
<nav id="myfooter" class="navbar navbar-default navbar-inverse navbar-fixed-bottom">
<div class="container" style="width:100%;padding:0px;">
<div class="navbar-header">
<ul>
<span class="navbar-brand"><a href="about.html" style="text-decoration: none !important;">About Us</a></span>
<span class="navbar-brand">
<a href="logout.php" class="btn btn-white-fill" style="margin-top: -0.1cm; text-decoration: none">LOGOUT<?php if (isset($_SESSION['username'])) {
echo "<span style = 'color:white'> (" . $_SESSION['username'] . ")</span>"; } ?></a>
</span>
</ul>
</div>
<p class="navbar-text navbar-right" style="font-weight: normal !important;font-size: 12;">BESE-6B - SEECS  | Ahmed Rana   Sohaib Zahid   Mana Tariq   Zara Malik   </p>
</div>
</nav>
</html>