-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_panel.php
More file actions
67 lines (38 loc) · 1.44 KB
/
admin_panel.php
File metadata and controls
67 lines (38 loc) · 1.44 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
<?php include("includes/header.php"); ?>
<?php include("includes/nav.php"); ?>
<div class="container" style="padding-top: 20px">
<div class="row">
<!-- course code entering field ---------------------------- -->
<div class="col-md-8">
<table >
<tr>
<form action="admin_panel.php" method="POST">
<td style="padding:5px"><b>Enter Course code:</b></td>
<td style="padding:5px"><input type="text" name="cscode" placeholder="e.g CS400 for Algorithms course"></td>
<td style="padding:5px"> <input type="submit" value="select & start"> </td>
</form>
</tr>
<!-- course select field ---------------------------------- -->
<?php
$con = mysqli_connect("localhost","root","","attendance");
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$course_id=$_POST['cscode'];
$_SESSION['course_id'] = $course_id;
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT * FROM courses WHERE course_code='$course_id'";
$result=mysqli_query($con,$sql);
$row=mysqli_fetch_assoc($result);
if(!empty($row['course_code'])){
header("location:take.php");
}
else{
echo "<script type='text/javascript'>alert('Code not recognized')</script>";
}
}
?>
</div>
<?php include("includes/footer.php"); ?>