-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistration.php
386 lines (364 loc) · 11 KB
/
registration.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?php
require "connection.php";
$conn = connect();
$hasDigit = false;
$hasSpecialChar = false;
$hasUppercase = false;
$hasLowercase = false;
if(isset($_POST['submit'])){
if(isset($_POST['name']) && isset($_POST['loginId']) && isset($_POST['email'])&& isset($_POST['mobile'])&& isset($_POST['gender'])&& isset($_POST['password'])&& isset($_POST['conpass'])){
$name = $_POST['name'];
$loginId = $_POST['loginId'];
$dob = date('Y-m-d', strtotime($_POST['dob']));
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$gender = $_POST['gender'];
$password = $_POST['password'];
$conpass = $_POST['conpass'];
if (preg_match("/[0-9]/", $password)) {
$hasDigit = true;
}
if (preg_match("/[^A-Za-z0-9]/", $password)) {
$hasSpecialChar = true;
}
if (preg_match("/[A-Z]/", $password)) {
$hasUppercase = true;
}
if (preg_match("/[a-z]/", $password)) {
$hasLowercase = true;
}
if ($hasDigit && $hasSpecialChar && $hasUppercase && $hasLowercase) {
$reg = "SELECT email FROM register";
$res = mysqli_query($conn,$reg);
if($res){
$flag = true;
if(mysqli_num_rows($res) > 0) {
while($row1 = mysqli_fetch_assoc($res)){
$logid = $row1["email"];
if($logid===$email)
$flag = false;
}}
//echo $logid;
// if($logid!=$email)
if($flag === true){
if($password===$conpass){
$sql = "INSERT INTO `demo`.`register` (`name`, `loginId`, `dob`, `email`, `mobile`, `gender`, `password`) VALUES ('$name', '$loginId', '$dob', '$email', '$mobile', '$gender', '$password')";
$query = mysqli_query($conn,$sql);
if($query){
$email1 = $email;
mail($email1,"Registration Successful","Thank You for Registering !");
// echo "Sign Up Successfull !";
echo "<script> alert('Sign Up Successfull !');
document.location.href = 'index.php';
</script>";
}
else{
echo "<script> alert('Login Id ALready In Use!!');
document.location.href = 'registration.php';
</script>";
}
}else{
// echo $logid;
// echo "password issue";
echo "<script>
alert('Password and Confirm Password Not Matched');
document.location.href = 'registration.php';
</script>";
}
}else {
echo "<script> alert('Email Id Already In Use !!');
document.location.href = 'registration.php';
</script>";
}
}
}else {
echo "<script> alert('Password should contain atleast one digit, uppercase, lowercase and a special character !!');
document.location.href = 'registration.php';
</script>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="CSS/register.css"> -->
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css">
<title>Regisration Form </title>
</head>
<body>
<img class="bg" style="height: 100vh; width: 100vw;" src="Img/renbg.jpg" alt="Image">
<div class="container">
<header>Registration</header>
<form action="registration.php" method="post">
<div class="form first">
<div class="details personal">
<span class="title">Personal Details</span>
<div class="fields">
<div class="input-field">
<label>Full Name</label>
<input type="text" placeholder="Enter your name" name="name" required>
</div>
<div class="input-field">
<label>Login ID</label>
<input type="text" placeholder="Create your login id" name="loginId" required>
</div>
<div class="input-field">
<label>Date of Birth</label>
<input type="date" id="date" placeholder="Enter birth date" name="dob" required>
</div>
<div class="input-field">
<label>Email</label>
<input type="text" placeholder="Enter your email" name="email" required>
</div>
<div class="input-field">
<label>Mobile Number</label>
<input type="number" min=1000000000 max=9999999999 placeholder="Enter mobile number" name="mobile" required>
</div>
<div class="input-field">
<label>Gender</label>
<select name="gender" required>
<option disabled selected>Select gender</option>
<option>Male</option>
<option>Female</option>
<option>Others</option>
</select>
</div>
<div class="input-field">
<label>Password</label>
<input type="password" min=898798354 pattern="/^[a-zA-Z0-9!@#\$%\^\&*_=+-]{8,12}$/g" placeholder="password" name="password" required>
</div>
<div class="input-field">
<label>Confirm Password</label>
<input type="password" placeholder="password" name="conpass" required>
</div>
<button type="submit" class="sumbit" name="submit">
<span class="btnText">Submit</span>
<i class="uil uil-navigator"></i>
</button>
<div class="register-link">
Already a member? <a href="login.php">Log In</a>
</div>
</div>
</div>
</div>
</form>
</div>
<script>
var dtToday = new Date();
var month = dtToday.getMonth() + 1;
var day = dtToday.getDate();
var year = dtToday.getFullYear()-18;
if(month < 10)
month = '0' + month.toString();
if(day < 10)
day = '0' + day.toString();
var maxDate = year + '-' + month + '-' + day;
document.getElementById("date").setAttribute('max', maxDate)
</script>
<style>
/* .submit {
background-color: #4070f4;
color: #fff;
} */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
/* background: #4070f4; */
}
.bg {
position: absolute;
z-index: -1;
opacity: 1;
}
.container{
position: relative;
max-width: 900px;
width: 100%;
border-radius: 6px;
padding: 30px;
margin: 0 15px;
background-color: #fff;
box-shadow: 0 5px 10px rgba(0,0,0,0.1);
height: 630px;
}
.container header{
margin-left: 350px;
position: relative;
font-size: 20px;
font-weight: 600;
color: #333;
}
.container header::before{
content: "";
position: absolute;
left: 0;
bottom: -2px;
height: 3px;
width: 27px;
border-radius: 8px;
background-color: #4070f4;
}
.container form{
position: relative;
margin-top: 16px;
min-height: 490px;
background-color: #fff;
/* overflow: hidden; */
}
.container form .form{
position: absolute;
background-color: #fff;
transition: 0.3s ease;
}
.container form .form.second{
opacity: 0;
pointer-events: none;
transform: translateX(100%);
}
form.secActive .form.second{
opacity: 1;
pointer-events: auto;
transform: translateX(0);
}
form.secActive .form.first{
opacity: 0;
pointer-events: none;
transform: translateX(-100%);
}
.container form .title{
display: block;
margin-bottom: 8px;
font-size: 18px;
font-weight: 500;
margin: 6px 0;
color: #333;
}
.container form .fields{
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
}
form .fields .input-field{
display: flex;
width: calc(100% / 2 - 15px);
flex-direction: column;
margin: 4px 0;
}
.input-field label{
font-size: 16px;
font-weight: 500;
color: #2e2e2e;
}
.input-field input, select{
outline: none;
font-size: 14px;
font-weight: 400;
color: #333;
border-radius: 5px;
border: 1px solid #aaa;
padding: 0 15px;
height: 42px;
margin: 8px 0;
}
.input-field input :focus,
.input-field select:focus{
box-shadow: 0 3px 6px rgba(0,0,0,0.13);
}
.input-field select,
.input-field input[type="date"]{
color: #707070;
}
.input-field input[type="date"]:valid{
color: #333;
}
.container form button, .backBtn{
display: flex;
align-items: center;
justify-content: center;
height: 45px;
/* max-width: 200px; */
width: 100%;
border: none;
outline: none;
color: #fff;
border-radius: 5px;
margin: 25px 0;
background-color: #4070f4;
transition: all 0.3s linear;
cursor: pointer;
}
.container form .btnText{
font-size: 20px;
font-weight: 400;
}
form button:hover{
background-color: #265df2;
}
form button i,
form .backBtn i{
margin: 0 6px;
}
form .backBtn i{
transform: rotate(180deg);
}
form .buttons{
display: flex;
align-items: center;
}
form .buttons button , .backBtn{
margin-right: 14px;
}
form .register-link {
/* background-color: #4070f4; */
margin: 0 auto;
font-size: 20px;
font-weight: 400;
transition: all 0.3s linear;
}
form .register-link a {
text-decoration: none;
color: blue;
font-size: 20px;
font-weight: 400;
transition: all 0.3s linear;
}
form .register-link a:hover{
text-decoration: underline;
font-weight: 500;
font-size: 22px;
transition: all 0.3s ;
}
@media (max-width: 750px) {
.container form{
overflow-y: scroll;
}
.container form::-webkit-scrollbar{
display: none;
}
form .fields .input-field{
width: calc(100% / 2 - 15px);
}
}
@media (max-width: 550px) {
form .fields .input-field{
width: 100%;
}
}
</style>
</body>
</html>
<!-- INSERT INTO `register` (`Sno`, `name`, `id`, `dob`, `email`, `mobile`, `gender`, `password`, `conpass`) VALUES ('1', 'test', 'test123', '2014-04-09', 'test@gmail.com', '9858495894', 'male', 'pass123', 'pass123'); -->