-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
107 lines (91 loc) · 4.85 KB
/
index.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
<?php
include("includes/header.php");
require 'includes/handlers/register_handler.php';
require 'includes/handlers/login_handler.php';
?>
<div class="login_box">
<div class="login_header">
<?php isset($user) ? print "You are logged in!": print "Login or Signup below" ?>
</div>
<div id="first">
<form action="index.php" method="POST">
<input type="email" name="log_email" placeholder="Email address"value="<?php
if (isset($_SESSION['log_email'])) {
echo $_SESSION['log_email'];
}
?>" required>
<br>
<input type="password" name="log_password" placeholder="Password">
<br>
<input type="submit" name="login_button" value="Log In">
<br>
<?php if(in_array("Email or password was incorrect.<br>", $error_array)){
echo "Email or password was incorrect.<br>";
} ?>
<br>
</form>
</div>
<div id="second">
<form action="index.php" method="POST">
<input type="text" name="reg_fname" placeholder="First name"
value="<?php
if (isset($_SESSION['reg_fname'])) {
echo $_SESSION['reg_fname'];
}
?>"
required>
<br>
<?php if(in_array("Your first name must be between 2 and 25 characters long.<br>", $error_array))
{ echo "Your first name must be between 2 and 25 characters long.<br>"; } ?>
<input type="text" name="reg_lname" placeholder="Last name"
value="<?php
if (isset($_SESSION['reg_lname'])) {
echo $_SESSION['reg_lname'];
}
?>"
required>
<br>
<input type="date" name="reg_bday" placeholder="Birthday" required>
<br>
<?php if(in_array("You must be at least 13 to register.<br>", $error_array))
{ echo "You must be at least 13 to register.<br>"; } ?>
<?php if(in_array("Your last name must be between 2 and 25 characters long.<br>", $error_array))
{ echo "Your last name must be between 2 and 25 characters long.<br>"; } ?>
<input type="email" name="reg_email" placeholder="Email"
value="<?php
if (isset($_SESSION['reg_email'])) {
echo $_SESSION['reg_email'];
}
?>"
required>
<br>
<?php if(in_array("Invalid email format.<br>", $error_array))
{ echo "Invalid email format.<br>"; } ?>
<input type="email" name="reg_email2" placeholder="Confirm Email"
value="<?php
if (isset($_SESSION['reg_email2'])) {
echo $_SESSION['reg_email2'];
}
?>"
required>
<br>
<?php if(in_array("Emails don't match.<br>", $error_array))
{ echo "Emails don't match.<br>"; } ?>
<input type="password" name="reg_password" placeholder="Password" required>
<br>
<?php if(in_array("Your password can only contain English characters or numbers.<br>", $error_array))
{ echo "Your password can only contain English characters or numbers.<br>"; } ?>
<input type="password" name="reg_password2" placeholder="Confirm Password" required>
<br>
<?php if(in_array("Your passwords do not match.<br>", $error_array))
{ echo "Your passwords do not match.<br>"; } ?>
<input type="submit" name="register_button" value="Register">
<br>
<?php if(in_array("<span style='color: #14C800'> You're all set! Go ahead and log in.</span>", $error_array))
{ echo "<span style='color: #14C800'> You're all set! Go ahead and log in.</span>"; } ?>
</form>
</div>
</div>
<?php
include("includes/footer.php");
?>