-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd_admin.php
83 lines (81 loc) · 3.87 KB
/
add_admin.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
<?php include("header.inc.php"); ?>
</div>
<section class="panel panel-default" style="border:none;">
<div class="row">
<div class="col-md-12" style="margin-bottom:20px;">
<div class="row">
<h3 style="text-align:left; margin-left:20px;">
<i class="fa fa-plus"></i> Add New Admin User
</h3>
<?php
if(isset($_POST['user'])){
function protect($field){
$string=htmlentities($field,ENT_QUOTES);
$string= mysql_real_escape_string(trim(strip_tags(addslashes($field))));
return $string;
}
$matric = protect($_POST['matric']);
$firstname = ucfirst($_POST['firstname']);
$lastname = ucfirst($_POST['lastname']);
$email = ucfirst($_POST['email']);
$password = $_POST['password'];
$query45 = "INSERT INTO user (matric,firstname,lastname,email,password,section)
values ('$matric', '$firstname', '$lastname', '$email', '$password', 'Admin')";
$result45 = mysql_query($query45) or die ("Couldn't execute query45");
echo("<script>location.href = 'users.php';</script>");
}
?>
<form action="add_admin.php" method="POST" class="form-horizontal form-label-left input_mask">
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<div class="col-md-2 col-sm-12 col-xs-12">
Matric No
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<input type="text" class="form-control has-feedback-left" name="matric" id="inputSuccess2" placeholder="Matric No" required>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<div class="col-md-2 col-sm-12 col-xs-12">
First name
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<input type="text" class="form-control has-feedback-left" name="firstname" id="inputSuccess2" placeholder="First Name" required>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<div class="col-md-2 col-sm-12 col-xs-12">
Last Name
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<input type="text" class="form-control has-feedback-left" name="lastname" id="inputSuccess2" placeholder="Last Name" required>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<div class="col-md-2 col-sm-12 col-xs-12">
Email
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<input type="email" class="form-control has-feedback-left" name="email" id="inputSuccess2" placeholder="Email" required>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<div class="col-md-2 col-sm-12 col-xs-12">
Password
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<input type="password" class="form-control has-feedback-left" name="password" placeholder="Password" id="inputSuccess2" required>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="col-md-6 col-sm-6 col-xs-12">
<a href="users.php" class="btn btn-default">Cancel</a>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<button type="submit" name="user" class="btn btn-info"> <i class="fa fa-user"></i> Add </button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php include("footer.inc.php"); ?>