-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminCreate.php
More file actions
139 lines (104 loc) · 4.62 KB
/
adminCreate.php
File metadata and controls
139 lines (104 loc) · 4.62 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
#!/usr/local/bin/php
<?php
$host = "127.0.0.1";
$user = "root";
$password = "";
$db="login_it";
session_start();
$data=mysqli_connect($host,$user,$password,$db);
$username=$_SESSION['username'];
$sql="SELECT * FROM users WHERE username='".$username."'";
$result=mysqli_query($data,$sql);
$row=mysqli_fetch_array($result);
if($row["usertype"]=="user")
{
header("location:userhome.php");
}else if($row["usertype"]=="employee"){
header("location:employeehome.php");
}
define('__HEADER_FOOTER_PHP__', true);
if(!isset($_SESSION["username"]))
{
header("location:login.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
<title>Register A User</title>
<!-- MAKE STYLE SHEET -->
<style>
form {
margin: 0 auto;
width: 350px;
background-color: aliceblue;
border: 2px #3f7778 solid;
padding: 20px;
}
</style>
</head>
<body style="font-family: K2D; background-color: #e0f2f3">
<div class="jumbotron jumbotron-fluid text-center" style="margin-bottom:0; padding: 40px ;background-color: cadetblue; color: aliceblue">
<a style="text-decoration: none; color: aliceblue; font-size: xx-large " href="adminhome.php">iTicket</a>
</div>
<nav class="navbar navbar-expand-sm justify-content-center" style=" background-color: #3f7778; color: #f0f8ff">
<ul class="navbar-nav">
<li class="nav-item" ><a class="nav-link" href="adminhome.php" style="color: aliceblue; ">Home</a></li>
<li class="nav-item" ><a class="nav-link" href="adminCreate.php" style="color: aliceblue; ">Register Users</a></li>
<li class="nav-item" ><a class="nav-link" href="admin_dash.php" style="color: aliceblue; ">View Tickets</a></li>
<li class="nav-item" ><a class="nav-link" href="logout.php" style="color: #98d8da; ">Logout <?php echo $_SESSION['username'] ?></a></li>
</ul>
</nav>
<!-- CITE: https://www.youtube.com/watch?v=ShbHwaiyOps
This is very similar to register, but this time admins can select user type-->
<br>
<h3 style="text-align: center; color: #3f7778">Register Users</h3>
<br>
<p style="text-align: center; color: #3f7778; margin: 0"><b>Requirements:</b></p>
<p style="text-align: center; color: #3f7778; margin: 0">1) Username and Email must be unique</p>
<p style="text-align: center; color: #3f7778; margin: 0">2) Password is 8 or more characters long</p>
<p style="text-align: center; color: #3f7778; margin: 0">3) Password contains letters and numbers</p>
<br>
<form class="" action="createAdminOrEmployee.php" method="POST" novalidate>
<div class="input-group">
<label style="padding: 5px; margin: 5px;text-align: left; ">Username</label>
<input style="padding: 5px; margin: 5px; width: 100%" type="text" id="username" name="username">
</div>
<div class="input-group" >
<label style="padding: 5px; margin: 5px;text-align: left; ">Password</label>
<input style="padding: 5px; margin: 5px; width: 100%" type="password" id="password" name="password">
</div>
<div class="input-group" >
<label style="padding: 5px; margin: 5px;text-align: left; ">Confirm Password</label>
<input style="padding: 5px; margin: 5px; width: 100%" type="password" id="passwordConfirm" name="passwordConfirm">
</div>
<div class="input-group" >
<label style="padding: 5px; margin: 5px;text-align: left; ">Email</label>
<input style="padding: 5px; margin: 5px; width: 100%" type="email" id="email" name="email">
</div>
<div>
<label style="padding: 5px; margin: 5px;text-align: left; ">Account Type</label>
<select style="padding: 5px; margin: 5px; width: 100%" id="userType" name="userType">
<option value="admin">Administrator</option>
<option value="employee">Employee</option>
<option value="user">User</option>
</select>
</div>
<br>
<div class="input-group justify-content-center" >
<button style="padding: 5px; margin: 5px; width: 40%;" type="submit" name="regAccount">Register User</button>
</div>
<br>
</form>
<br>
<br>
<footer class="text-center" style="background-color: #3f7778; color: #F0F8FFFF; padding: 15px">
<p>© Debug Divas 2024</p>
<p>CEN3031 Final Project</p>
</footer>
</body>
</html>