-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
241 lines (204 loc) · 5.93 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
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
<!DOCTYPE html>
<html>
<!------Head----------->
<head>
<title>Codether</title>
<link href="icon2.png" rel="icon">
<link href="css/style.css" rel="stylesheet" type="text/css">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js"></script>
<script type="text/javascript">
function check(email,pass1,pass2){
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var passw = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/;
if(email.value.match(mailformat))
{
email.setCustomValidity("");
if(pass1.value.match(passw))
{ pass1.setCustomValidity("");
if(pass1.value==pass2.value){
<?php
include("config.php");
if(isset($_POST['submit'])) {
$uname = $_POST['uname'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$pass = $_POST['psw1'];
mysqli_query($mysqli, "INSERT INTO users(uname,fname,lname, email, password) VALUES('$uname','$fname','$lname', '$email', md5('$pass'))")
or die("Username or Email already exists");
header("Location: signin.php");
} else {
echo "Something Went Wrong.";
}
?>
return;
}
else{
pass2.setCustomValidity("Passwords do not match");
return;
}
}
else{
pass1.setCustomValidity("Passwords must contain 6-20 characters,at least one number,at least one uppercase letter and one lowercase letter");
return;
}
}
else{
email.setCustomValidity("Enter Correct Email");
return;
}
return;
}
</script>
<!------Style----------->
<style>
.error {
color: red;
margin-left: 5px;
}
label.error {
display: inline;
}
form{
border-radius: 1em;
margin-top: 3.125em;
background-color: rgb(0, 0, 0,0.5);
width: 50%;
margin-bottom: 2em;
}
input[type=text], input[type=password] {
border-radius: 1em;
width: 100%;
padding: 0.9375em;
margin: 0.3125em 0 1.375em 0;
display: inline-block;
border: none;
background: #f1f1f1;
font-family: exo;
}
input[type=text]:focus, input[type=password]:focus {
background-color: #ddd;
outline: none;
}
hr {
border: 0.0625em solid #f1f1f1;
margin-bottom: 1.5625em;
}
input[type=submit] {
color: white;
padding: 0.875em 1.25em;
margin: 0.5em 0;
border: none;
cursor: pointer;
width: 100%;
font-family: exo;
opacity: 0.9;
}
input[type=submit]:hover {
opacity:1;
}
.container {
padding: 1em;
text-align: left;
}
}
</style>
<!------Style----------->
</head>
<!------Body----------->
<body>
<div class="bg"></div>
<div class="bg bg2"></div>
<div class="bg bg3"></div>
<!------Header----------->
<header>
<div class="row">
<!------NavBar----------->
<div class="navbar col-12">
<div class="webname col-m-12 col-8">
<h1>Codether</h1>
</div>
<ul class=" col-m-12 col-4">
<li>
<a href="index.php">Home</a>
</li>
<li>
<a href="index.php#aboutsect">About</a>
</li>
<li>
<a class="active" href="register.php">Register</a>
</li>
<li>
<a href="signin.php">Log In</a>
</li>
<li>
<a href="index.php#contactsect">Contact</a>
</li>
</ul>
</div>
</div>
</header>
<!------Div for Align----------->
<div class="col-3"></div>
<!------Form----------->
<form name="regform" id="regform" action="" method="post" class="col-m-12 col-6" style="border:0.0625em solid #ccc">
<div class="container">
<h1>Register</h1>
<hr>
<label for="fname"><b>First Name</b></label> <input name="fname" required="" id="fname" placeholder="Enter First Name" type="text">
<label for="lname"><b>Last Name</b></label> <input name="lname" id="lname" placeholder="Enter Last Name" required="" type="text" >
<label for="uname"><b>Username</b></label> <input name="uname" required="" id="uname" placeholder="Enter Username" type="text">
<label id="msg" for="email"><b>Email</b></label> <input name="email" id="email" placeholder="Enter Email" required="" type="text">
<label for="psw"><b>Password</b></label> <input name="psw1" id="psw1" placeholder="Enter Password" required="" type="password">
<label for="psw-repeat"><b>Repeat Password</b></label> <input name="psw2" id="psw2" placeholder="Repeat Password" required="" type="password">
<p>Already a User? <a href="signin.php" style="color:orange">Log In Here</a></p>
<div>
<input name="submit" id="submit" class="register" type="submit" value="Register" onclick="check(document.regform.email,document.regform.psw1,document.regform.psw2)">
</div>
</div>
</form>
<!------Footer----------->
<footer class="col-12 col-m-12" id="contactsect">
<div class="row">
<h1>Contact Us</h1>
<!------Table1----------->
<div class=" col-8 tab1">
<table>
<tr>
<td><img src="img/add.png"></td>
<td>Silicon Valley<br>
California, USA</td>
</tr>
<tr>
<td><img src="img/cont.png"></td>
<td>408-920-5006</td>
</tr>
<tr>
<td><img src="img/email.png"></td>
<td>fzulfiqar@codether.co.uk</td>
</tr>
</table>
</div>
<!------Table2----------->
<div class=" col-4 tab2">
<table>
<tr>
<td><img src="img/fb.png"></td>
<td>codether@facebook</td>
</tr>
<tr>
<td><img src="img/twi.png"></td>
<td>codether@twitter</td>
</tr>
<tr>
<td><img src="img/link.png"></td>
<td>codether@linkedin</td>
</tr>
</table>
</div>
</div>
</footer>
</body>
</html>