-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_account.php
116 lines (106 loc) · 5.14 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
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
<html>
<head>
<link rel="stylesheet" href="create_accour.css?v=f">
<?php include "stylesheets.php" ?>
<script src = "JS/validation_functions.php"></script>
<script src = "JS/create_account_validation.js"></script>
</head>
<body>
<div id="body">
<div id="headerBar"> <a href="login.php"><i class="fas fa-arrow-circle-left"></i></a>
<div id="title-position">
<h1>Create an Account</h1> </div>
</div>
<div id="container">
<form id ="submit" action="account_handler.php" method="post">
<div id = "input">
<div id="label">
<label for="email">
<h3>Email Address</h3></label>
</div>
<input class="input-text" type="text" id="email" name="email" placeholder="Email Address" value="<?php session_start(); if(isset($_SESSION['savedForm']['email1'])) echo $_SESSION['savedForm']['email1'];?>"></input>
<span class = "error">
</div>
<?php
if(isset($_SESSION['errors']['emptyEmail1']) && $_SESSION['errors']['emptyEmail1']){
echo "*";
}
if(isset($_SESSION['errors']['email1Valid']) && !$_SESSION['errors']['email1Valid']){
echo "Email is not in the correct format";
}
?>
</span>
<div id="input">
<div id="label">
<label for="confirmEmail">
<h3>Confirm Email</h3></label>
</div>
<input class="input-text" type="text" id="confirmEmail" name="confirmEmail" placeholder="Confirm Email" value="<?php if(isset($_SESSION['savedForm']['email2'])) echo $_SESSION['savedForm']['email2'];?>"></input>
<span class = "error">
<?php
if(isset($_SESSION['errors']['emptyEmail2']) && $_SESSION['errors']['emptyEmail2']){
echo "*";
}
if(isset($_SESSION['errors']['email2Valid']) && !$_SESSION['errors']['email2Valid']){
echo "Email is not in the correct format";
}
?>
</span>
</div>
<div id="input">
<div id="label">
<label for="password">
<h3>Password</h3></label>
</div>
<input class="input-text" type="password" id="password" name="password" placeholder="Password"></input>
<span class = "error">
<?php
if(isset($_SESSION['errors']['emptyPassword1']) && $_SESSION['errors']['emptyPassword1']){
echo "*";
}
if(isset($_SESSION['errors']['password1Valid']) && !$_SESSION['errors']['password1Valid']){
echo "Password must be 8 characters long and contain one special character and number";
}
?>
</span>
</div>
<div id="input">
<div id="label">
<label for="confirmPassword">
<h3>Confirm Password</h3></label>
</div>
<input class="input-text" type="password" id="confirmPassword" name="confirmPassword" placeholder="Confirm Password"></input>
<span class = "error">
<?php
if(isset($_SESSION['errors']['emptyPassword2']) && $_SESSION['errors']['emptyPassword2']){
echo "*";
}
if(isset($_SESSION['errors']['password2Valid']) && !$_SESSION['errors']['password2Valid']){
echo "Password must be 8 characters long and contain one special character and number";
}
?>
</span>
</div>
<div id = "additionalErrors">
<?php
if(isset($_SESSION['additionalErrors']) && count($_SESSION['additionalErrors'])){
echo'<h3>Additional Errors</h3>';
foreach ($_SESSION['additionalErrors'] as $error ){
echo '<div id = "error_box">
<span class="error_symbol"><i class="fas fa-exclamation-triangle"></i></span>
<span class = "middle">'.$error.'</span>
<span class = "right"><i class="fas fa-times-circle"></i></span>
</div>';
}
}
$_SESSION['additionalErrors'] = NULL;
$_SESSION['errors'] = NULL;
$_SESSION['savedForm'] = NULL;
?>
</div>
<button type = "submit">Create Account</button>
</form>
</div>
</div>
</body>
</html>