-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin.php
83 lines (73 loc) · 2.73 KB
/
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
require 'conn.php';
if(isset($_POST['submit'])){
$fname = ucfirst($_POST['fname']);
$lname = ucfirst($_POST['lname']);
$user = strtolower($_POST['user']);
$pass = md5($_POST['pass']);
$role = 'teacher'; // new admin can only registered as teacher not as master admin
$query = mysqli_query($con, "insert into admin values('','$fname','$lname','$user','$pass','admin')") or die(mysqli_error($con));
if($query == 1){
echo "<script>alert('You are successfully registered as an admin.');
window.location.href='index.php';
</script>";
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<?php include_once "stylesheet.php";?>
<title>S-HUB | Sign-Up</title>
</head>
<body>
<div class="container"> <!-- bootstrap container start -->
<div class="row justify-content-center"> <!-- bootstrap container row -->
<div class="col-sm-6">
<div class="card p-4 mb-4 mt-5">
<h1 class="h1-responsive" align="center">Student-HUB</h1>
</div>
</div>
</div> <!-- bootstrap container row end -->
<div class="row justify-content-center"> <!-- bootstrap container row -->
<div class="col-sm-6">
<div class="card p-4 mb-4 mt-5">
<h5 class="card-title text-center mb-5">Admin Sign-Up</h5>
<form method="post"> <!-- bootstrap foem start -->
<div class="form-row">
<div class="form-group col">
<label for="" class="sr-only">First Name :</label>
<input type="text" name="fname" placeholder="First Name" class="form-control" required>
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="" class="sr-only">Last Name :</label>
<input type="text" name="lname" placeholder="Last Name" class="form-control" required>
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="" class="sr-only">User Name :</label>
<input type="text" name="user" placeholder="User Name" class="form-control" required>
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="" class="sr-only">Password :</label>
<input type="password" name="pass" placeholder="Password" class="form-control" required>
</div>
</div>
<button type="submit" name="submit" class="btn btn-primary btn-block">Sign-Up</button>
</form> <!-- bootstrap form end -->
</div>
</div>
</div> <!-- bootstrap container row end -->
</div> <!-- bootstrap container end -->
<?php include_once "script.php";?>
</body>
</html>