forked from AngelaBubble/Dog_Walker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
142 lines (110 loc) · 4.52 KB
/
register.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
require 'config/config.php';
require 'includes/form_handlers/register_handler.php';
require 'includes/form_handlers/login_handler.php';
?>
<html>
<head>
<title>Welcome to Dog Walker!</title>
<link rel="stylesheet" type="text/css" href="assets/css/register_style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="assets/js/register.js"></script>
<style>
#select-option{
width:75%;
}
</style>
</head>
<body>
<?php
if(isset($_POST['register_button'])) {
echo '
<script>
$(document).ready(function() {
$("#first").hide();
$("#second").show();
});
</script>
';
}
?>
<div class="wrapper">
<div class="login_box">
<div class="login_header">
<h1>Dog Walker!</h1>
Login or sign up below!
</div>
<br>
<div id="first">
<form action="register.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>
<?php if(in_array("Email or password was incorrect<br>", $error_array)) echo "Email or password was incorrect<br>"; ?>
<input type="submit" name="login_button" value="Login">
<br>
<a href="#" id="signup" class="signup">Need an account? Register here!</a>
</form>
</div>
<div id="second">
<form action="register.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<br>", $error_array)) echo "Your first name must be between 2 and 25 characters<br>"; ?>
<input type="text" name="reg_lname" placeholder="Last Name" value="<?php
if(isset($_SESSION['reg_lname'])) {
echo $_SESSION['reg_lname'];
}
?>" required>
<br>
<?php if(in_array("Your last name must be between 2 and 25 characters<br>", $error_array)) echo "Your last name must be between 2 and 25 characters<br>"; ?>
<input type="email" name="reg_email" placeholder="Email" value="<?php
if(isset($_SESSION['reg_email'])) {
echo $_SESSION['reg_email'];
}
?>" required>
<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("Email already in use<br>", $error_array)) echo "Email already in use<br>";
else if(in_array("Invalid email format<br>", $error_array)) echo "Invalid email format<br>";
else 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>
<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>";
else 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>";
else if(in_array("Your password must be betwen 5 and 30 characters<br>", $error_array)) echo "Your password must be betwen 5 and 30 characters<br>"; ?>
<input type="text" name="reg_address" placeholder="Address: eg: 775 Commonwealth Ave, Boston" required>
<br>
<a>Are you a dog owner or a dog walker? Please select</a>
<select id="select-option" class="custom-select" name="reg_dogowner">
<option value="true"> Dog Owner </option>
<option value="false" selected>Dog Walker</option>
</select>
<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 login!</span><br>", $error_array)) echo "<span style='color: #14C800;'>You're all set! Go ahead and login!</span><br>"; ?>
<a href="#" id="signin" class="signin">Already have an account? Sign in here!</a>
</form>
</div>
</div>
</div>
</body>
</html>