-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
239 lines (208 loc) · 6.09 KB
/
signup.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
<?php include 'includes/db_connection.php';
$conn = OpenCon();
session_start();
if(isset($_SESSION['loginuser'])){
header("location: index.php");
}
?>
<!DOCTYPE html>
<html>
<style>
body {font-family: Arial, Helvetica, sans-serif;}
* {box-sizing: border-box}
/* Full-width input fields */
input[type=text], input[type=password] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
display: inline-block;
border: none;
background: #f1f1f1;
}
/* Add a background color when the inputs get focus */
input[type=text]:focus, input[type=password]:focus {
background-color: #ddd;
outline: none;
}
/* Set a style for all buttons */
button {
background-color: black;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
opacity: 0.9;
}
button:hover {
opacity:1;
}
/* Extra styles for the cancel button */
.cancelbtn {
padding: 14px 20px;
background-color: #f44336;
}
/* Float cancel and signup buttons and add an equal width */
.cancelbtn, .signupbtn {
float: left;
width: 50%;
}
/* Add padding to container elements */
.container {
padding: 16px;
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: #474e5d;
padding-top: 50px;
}
/* Modal Content/Box */
.modal-content {
background-color: #fefefe;
margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */
border: 1px solid #888;
width: 50%; /* Could be more or less, depending on screen size */
}
/* Style the horizontal ruler */
hr {
border: 1px solid #f1f1f1;
margin-bottom: 25px;
}
/* The Close Button (x) */
.close {
position: absolute;
right: 35px;
top: 15px;
font-size: 40px;
font-weight: bold;
color: #f1f1f1;
}
.close:hover,
.close:focus {
color: #f44336;
cursor: pointer;
}
/* Clear floats */
.clearfix::after {
content: "";
clear: both;
display: table;
}
/* Add Zoom Animation */
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
@-webkit-keyframes animatezoom {
from {-webkit-transform: scale(0)}
to {-webkit-transform: scale(1)}
}
@keyframes animatezoom {
from {transform: scale(0)}
to {transform: scale(1)}
}
/* Change styles for cancel button and signup button on extra small screens */
@media screen and (max-width: 300px) {
.cancelbtn, .signupbtn {
width: 100%;
}
}
</style>
<body>
<form id="signupform" class="modal-content animate" action="verifyLogin.php" onsubmit="return signupValidation()" method="post">
<div class="container">
<h1>Sign Up</h1>
<hr>
<br>
<label for="email"><b>Email</b></label>
<input id = "signupInputEmail" type="text" placeholder="Enter Email" name="signupInputEmail" required>
<p id="vfailemail"></p>
<label for="psw"><b>Password</b></label>
<input id="signupInputPassword1" type="password" placeholder="Enter Password" name="signupInputPassword1" required>
<p id = "vfailpw"></p>
<label for="psw-repeat"><b>Repeat Password</b></label>
<input id="signupInputPassword2" type="password" placeholder="Repeat Password" name="signupInputPassword2" required>
<p id = "vfailpw2"></p>
<label>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</label>
<input type="hidden" name = "submitsignup">
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
<button type="button" class="signupbtn" onclick="return signupValidation()">Sign Up</button>
</div>
</div>
</form>
</div>
</body>
<script>
function signupValidation() {
mailValidation();
pwValidation();
pwMatch();
if(mailValidation() && pwValidation() && pwMatch()) {
document.getElementById("signupform").submit();
}
else{
return false;
}
}
</script>
<script>
var txtemail="Please enter your email address";
function mailValidation(){
var inputEmail = document.getElementById("signupInputEmail").value;
if(inputEmail.length < 6 ) {
document.getElementById("vfailemail").innerHTML = txtemail;
document.getElementById("signupInputEmail").style.borderColor = "#E34234";
}
else{
document.getElementById("vfailemail").innerHTML = null ;
document.getElementById("signupInputEmail").style.borderColor = "#008000";
return true;
}
}
</script>
<script>
var txtpw1="Password must between 6 character to 15 character";
function pwValidation(){
var inputpw1 = document.getElementById("signupInputPassword1").value;
if(inputpw1.length < 6 || inputpw1.length > 15){
document.getElementById("vfailpw").innerHTML = txtpw1 ;
document.getElementById("signupInputPassword1").style.borderColor = "#E34234";
document.getElementById("signupInputPassword2").style.borderColor = "#E34234";
}
else{
document.getElementById("vfailpw").innerHTML = null ;
document.getElementById("signupInputPassword1").style.borderColor = "#008000";
return true;
}
}
</script>
<script>
var txtpwmiss="Password missmatch";
function pwMatch(){
var inputpw1 = document.getElementById("signupInputPassword1").value;
var inputpw2 = document.getElementById("signupInputPassword2").value;
if(inputpw1=="" || inputpw2 != inputpw1 ){
document.getElementById("vfailpw2").innerHTML = txtpwmiss ;
document.getElementById("signupInputPassword2").style.borderColor = "#E34234";
}
else{
document.getElementById("vfailpw2").innerHTML = null ;
document.getElementById("signupInputPassword2").style.borderColor = "#008000";
return true;
}
}
</script>
</html>