/
create_account.php
63 lines (59 loc) · 1.46 KB
/
create_account.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
<?php
session_start();
include 'account_utils.php';
require_once 'mysqli_connect.php';
if (isset($_SESSION['login'])) {
header("Location: index.php");
exit;
}
if (isset($_POST['create_account'])) {
$username = $_POST['username'];
$password = $_POST['password'];
if (create_user($dbc, $username, $password, $_POST['password2'], $_POST['firstname'], $_POST['lastname'])) {
login($dbc, $username, $password);
header("Location: picks_table.php");
} else {
echo
'
Something went wrong and I\'m too tired to figure it out.
<form action="create_account.php" method="post">
User name:<br>
<input type="text" name="username"><br>
User password:<br>
<input type="password" name="password"><br>
Re-enter password:<br>
<input type="password" name="password2"><br>
First Name:<br>
<input type="text" name="firstname"><br>
Last Name:<br>
<input type="text" name="lastname"><br>
<p>
<input type="submit" name="create_account" value="Create Account" />
</p>
</form>
';
}
} else {
echo
'
<form action="create_account.php" method="post">
User name:<br>
<input type="text" name="username"><br>
User password:<br>
<input type="password" name="password"><br>
Re-enter password:<br>
<input type="password" name="password2"><br>
First Name:<br>
<input type="text" name="firstname"><br>
Last Name:<br>
<input type="text" name="lastname"><br>
<p>
<input type="submit" name="create_account" value="Create Account" />
</p>
</form>
';
}
mysqli_close($dbc);
?>
</body>
</html>