forked from walteranyika/movie-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-user.php
66 lines (54 loc) · 2.13 KB
/
add-user.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
<?php
include 'protect.php';
include 'protect-admins.php';
if ( isset($_REQUEST["password"]) )
{
$names = $_REQUEST["names"];
$email = $_REQUEST["email"];
$password = $_REQUEST["password"];
$password = password_hash($password, PASSWORD_BCRYPT);
//$con = mysqli_connect("localhost", "root", "root", "supermarket") or die(mysqli_connect_error());
require 'connect.php';
$sql = "INSERT INTO `users`(`id`, `names`, `email`, `password`) VALUES (null,'$names','$email','$password')";
mysqli_query($con, $sql) or die(mysqli_error($con));
header("location:add-user.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Form</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>
<?php include 'nav.php' ?>
<div class="container">
<div class="row justify-content-center">
<div class="col-sm-5">
<h4>New User</h4>
<form action="add-user.php" method="post">
<div class="form-group">
<label>Names</label>
<input type="text" class="form-control" name="names" required>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" class="form-control" name="email" required>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" name="password" required>
</div>
<button class="btn btn-success">Add User</button>
</form>
</div>
</div>
</div>
</body>
</html>