-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin-addUser.php
More file actions
56 lines (54 loc) · 1.9 KB
/
Copy pathadmin-addUser.php
File metadata and controls
56 lines (54 loc) · 1.9 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
<?php
require_once "user.php";
CheckIfAdminLoggedIn();
include 'Geeksforsaletop.php';
if(isset($_POST['username']))
{
$username = $_POST['username'];
$streetAddress = $_POST['streetAddress'];
$postCode = $_POST['postCode'];
$country = $_POST['country'];
$email = $_POST['email'];
$password = $_POST['password'];
$userLevel = $_POST['userLevel'];
try
{
registerUser($db,$username, $streetAddress, $postCode, $country, $email, $password, $userLevel,0);
// Redirect back to homepage
header( 'Location: admin.php' );
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
?>
<div id= "content">
<?php include 'admin-buttons.php'; ?>
<p>Add user<br>
<form action="admin-addUser.php" method="post"
enctype="multipart/form-data">
<label for="username">Username</label>
<input type="text" name="username" required="required"/><br>
<label for="streetAddress">Street address</label>
<input type="text" name="streetAddress" required="required"/><br>
<label for="postCode">Postal code</label>
<input type="number" name="postCode" required="required" min=0 max=99999/><br>
<label for="country">Country</label>
<select id="country" name="country" required>
<?php include 'countryList.php'; ?>
<option selected="selected">Norway</option>
</select></br>
<label for="email">E-mail</label>
<input type="email" name="email" required="requried"/><br>
<label for="password">Password</label>
<input type="password" name="password" required="required"/><br>
<label for="userLevel">User level.</label>
<select id="userLevel" name="userLevel" required>
<option value="0">0 - Normal user</option>
<option value="1">1 - Worker</option>
<option value="2">2 - admin</option>
</select></br>
<input type="submit" name="submit" value="Add new user">
</form>
</div>