-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
269 lines (258 loc) · 12.7 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<title>Bank Savemander</title>
<link rel="stylesheet" href="style/login-styles.css">
</head>
<body>
<?php
session_start();
echo '<a href="./index.php?user_login=1"></a>';
if (isset($_SESSION['error_message']))
{
echo "<script>alert('" . $_SESSION['error_message'] . "');</script>";
unset($_SESSION['error_message']);
}
$EMAIL_PATTERN = "[^@\s]+@[^@\s]+\.[^@\s]+";
$PASSWORD_PATTERN = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,}$";
?>
<?php
// echo <<< USER_ACTION
// <a href="index.php?user_login=1"><input type="button" value="Login"></a>
// <a href="index.php?user_login=0"><input type="button" value="Register"></a>
// USER_ACTION;
// Display login form if user_login is not set or is true
if (!isset($_GET["user_login"]) || $_GET["user_login"]) {
echo <<< LOGIN_FORM
<div class="navbar-logo-left wf-section">
<div
data-animation="default"
data-collapse="medium"
data-duration="400"
data-easing="ease"
data-easing2="ease"
role="banner"
class="navbar-logo-left-container shadow-three w-nav"
>
<div class="container-3">
<img
src="./pages/img/brand-name.svg"
class="image-3"
/>
</div>
</div>
</div>
<section class="section-3 wf-section">
<div class="container-l w-container">
<h1 class="heading">
Login
</h1>
<div class="w-form">
<form
id="email-form"
name="email-form"
data-name="Email Form"
action="scripts/handlers/user_handler.php?user_action=l"
method="POST"
>
<label for="login-mail" class="field-label">Enter login</label>
<input
type="text"
class="text-field-2 w-input"
autofocus="true"
maxlength="50"
name="email"
data-name="login-mail"
placeholder="Enter your email"
pattern="$EMAIL_PATTERN"
title="Invalid email address"
id="login-mail"
required
/>
<label for="password" class="field-label">Enter password</label>
<input
type="password"
class="text-field-2 w-input"
maxlength="60"
name="password"
data-name="password"
placeholder="Enter password"
id="password"
required
/>
<input
type="submit"
value="Login"
data-wait="Please wait..."
class="submit-button w-button"
/>
</form>
</div>
<a href="./index.php?user_login=0" class="link">
Click here if you want to create an account.
</a>
</div>
</section>
LOGIN_FORM;
// <form action="scripts/handlers/user_handler.php?user_action=l" method="POST">
// <input type="text" name="email" pattern="$EMAIL_PATTERN" title="Invalid email address" placeholder="Email" required> <br>
// <input type="password" name="password" placeholder="Password" required> <br>
// <input type="submit" value="Login">
// </form>
}
// Display register form if user_login is false
else if (!$_GET["user_login"]) {
echo <<< REGISTER_FORM
<div class="navbar-logo-left wf-section">
<div class="container-3">
<img
src="./pages/img/brand-name.svg"
loading="lazy"
alt=""
class="image-3"
/>
</div>
</div>
<section class="section-3 wf-section">
<div class="container-r w-container">
<h1 class="heading">
Register
</h1>
<div class="w-form">
<form
id="email-form"
name="email-form"
data-name="Email Form"
action="scripts/handlers/user_handler.php?user_action=r"
method="POST"
class="form"
>
<div class="div-block-8">
<div class="div-block-9">
<label for="first-name" class="field-label">FIRST NAME</label>
<input
type="text"
class="text-field-2 w-input"
autofocus="true"
maxlength="50"
name="first_name"
data-name="first-name"
placeholder="Enter your first name"
id="first-name"
required
/><label for="last-name" class="field-label">LAST NAME</label>
<input
type="text"
class="text-field-2 w-input"
maxlength="50"
name="last_name"
data-name="last-name"
placeholder="Enter your last name"
id="last-name"
required
/><label for="email" class="field-label">Email</label>
<input
type="text"
class="text-field-2 w-input"
maxlength="50"
name="email"
data-name="email"
placeholder="Enter your email"
id="email"
pattern="$EMAIL_PATTERN"
title="Invalid email address"
required
/><label for="street-adress-4" class="field-label">Password</label>
<input
type="password"
class="text-field-2 w-input"
maxlength="60"
name="password"
data-name="street-adress-2"
placeholder="Enter your password"
id="street-adress-5"
minlength="8"
pattern="$PASSWORD_PATTERN"
title="Password needs to include one lowercase letter, one uppercase letter, one number and one special character"
required
/>
</div>
<div class="div-block-10">
<label for="street-adress-3" class="field-label">Address</label>
<input
type="text"
class="text-field-2 w-input"
maxlength="50"
name="address"
data-name="street-adress"
placeholder="Enter your street address"
id="street-adress-3"
required
/><label for="phone-number" class="field-label">phone number</label>
<input
type="tel"
class="text-field-2 w-input"
maxlength="9"
name="phone_number"
data-name="phone-number"
placeholder="e.g. 123456789"
id="phone-number"
required
/>
<div class="div-block-5">
<div class="div-block-6">
<label for="pesel" class="field-label">PESEL</label>
<input
type="text"
class="text-field-2 w-input"
minlength="11"
maxlength="11"
name="pesel"
data-name="City 2"
id="pesel"
placeholder="e.g. 01123456789"
required
/>
</div>
<div class="div-block-12">
<label class="w-checkbox"
><span class="w-form-label"
>By registering, I agree to:
<a href="http://www.example.com" target="_blank"
>terms & conditions.</a
></span
></label
>
</div>
</div>
</div>
</div>
<input
type="submit"
value="Register"
data-wait="Please wait..."
class="submit-button w-button"
/>
</form>
</div>
<a href="./index.php?user_login=1" class="link">Click here if you have an account.</a>
</div>
</section>
REGISTER_FORM;
// <form action="scripts/handlers/user_handler.php?user_action=r" method="POST">
// <input type="text" name="first_name" placeholder="First name" required> <br>
// <input type="text" name="last_name" placeholder="Last name" required> <br>
// <input type="text" name="email" pattern="$EMAIL_PATTERN" title="Invalid email address" placeholder="Email" required> <br>
// <input type="password" minlength="8" name="password" pattern="$PASSWORD_PATTERN" title="Password needs to include one lowercase letter, one uppercase letter, one number and one special character" placeholder="Password" required> <br>
// <input type="text" minlength="11" maxlength="11" name="pesel" placeholder="PESEL" required> <br>
// <input type="text" name="address" placeholder="Address" required> <br>
// <input type="text" minlength="9" maxlength="9" name="phone_number" placeholder="Phone number" required> <br>
// <input type="submit" value="Register">
// </form>
}
?>
</body>
</html>