-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_user.php
More file actions
54 lines (46 loc) · 1.83 KB
/
create_user.php
File metadata and controls
54 lines (46 loc) · 1.83 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
<!DOCTYPE html>
<!--
/*
* SER 322 Team 03 Pantry Project
* Terin Champion
* Hajar Boughoula
* Nergal Givarkes
*/
/**
* Author: Terin
* Created: Jun 18, 2017
*/
-->
<html>
<head>
<meta charset="UTF-8">
<title>SER322 Pantry Project - Create User</title>
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<?php
require_once '/config/config.php';
mysqli_select_db($conn, "ser322Pantry");
?>
<h1>Create User</h1>
<p>Enter User Information</p>
<form action="create_user.php" method="post">
User Email:<br><input type="text" name="userEmail"><br>
First Name:<br><input type="text" name="firstName"><br>
Last Name:<br><input type="text" name="lastName"><br>
Password:<br><input type="password" name="password"><br>
<input type="submit" name="submit" value="Create User"><br>
<button type="button" name="index" onclick="window.location='index.php'">Return to Login</button><br>
</form>
<?php
if(isset($_POST['userEmail']) && isset($_POST['firstName']) && isset($_POST['lastName']) && isset($_POST['password'])){
$sql = "INSERT INTO users (firstName, lastName, email, pass) VALUES ( '" . $_POST['firstName'] ."', '" .
$_POST['lastName'] . "', '" . $_POST['userEmail'] . "', '" . $_POST['password'] . "')";
while(mysqli_more_results($conn)){mysqli_next_result($conn);}
$conn->query($sql);
echo 'User ' . $_POST['userEmail'] . ' created<br>';
echo 'Return to Login Page and LOGIN!';
}
?>
</body>
</html>