-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php
101 lines (95 loc) · 4.08 KB
/
index.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
<?php
include 'include/global.php';
if (isset($_POST['submit'])) {
$user_name = $_POST['user_name'];
$department = $_POST['department'];
$level = $_POST['level'];
if (!empty($user_name) && !empty($department) && !empty($level)){
$sql = "SELECT user_name FROM user WHERE user_name = '".$user_name."'";
$result = mysql_query($sql);
$row = mysql_num_rows($result);
if ($row>0) {
?>
<script type="text/javascript">
alert("Matric Number Exist Try again");
</script>
<?php
}else {
if ($level==100 || $level==200 || $level==300 || $level==400 || $level==500 || $level==600){
$query = "INSERT INTO user (user_name,department,level) VALUES('$user_name','$department','$level')";
mysql_query($query) or die("Error Inserting into db");
}else{
?>
<script type="text/javascript">
alert("Invalid Level. Try again");
</script>
<?php
}
}
echo "Success";
}
}
?>
<?php include("auth.php"); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Student</title>
<?php include 'include/head.php'; ?>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Biometric Attendance</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="#" onclick="load('<?php echo $base_path?>')">Add</a></li>
<li><a href="#" onclick="load('<?php echo $base_path?>user.php?action=index')">Student</a></li>
<li><a href="#" onclick="load('<?php echo $base_path?>login.php?action=index')">Mark</a></li>
<li><a href="#" onclick="load('<?php echo $base_path?>log.php?action=index')">Log</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="content">
<div class="row">
<div class="container ">
<div class="col-md-4">
<form method="post">
<div class="form-group">
<label for="user_name">Matric Number</label>
<input type="text" id="user_name" name="user_name" class="form-control" placeholder="Enter Matric Number">
</div>
<div class="form-group">
<label for="department">Department</label>
<input type="text" id="department" name="department" id="department" class="form-control" placeholder="Enter Department">
</div>
<div class="form-group">
<label for="level">Level</label>
<input type="number" id="level" name="level" id="level" class="form-control" placeholder="Level of Study">
</div>
<input type="submit" class="btn btn-success" value="Add" name="submit" />
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>