-
Notifications
You must be signed in to change notification settings - Fork 2
/
signup.php
675 lines (605 loc) · 22.5 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
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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
<html>
<?php require ("header.php");?>
<?php
if (isset($_POST['studsu'])) {
session_start();
if (isset($_POST['name1']) && isset($_POST['usn1']) && isset($_POST['mail1']) && isset($_POST['phno1']) && isset($_POST['dept1']) && isset($_POST['dob1']) && isset($_POST['gender1']) && isset($_POST['password1']) && isset($_POST['cpassword1'])) {
require_once 'sql.php';
$conn = mysqli_connect($host, $user, $ps, $project); if (!$conn) {
echo "<script>alert(\"Database error retry after some time !\")</script>";
}
$name1 = mysqli_real_escape_string($conn, $_POST['name1']);
$usn1 = mysqli_real_escape_string($conn, $_POST['usn1']);
$mail1 = mysqli_real_escape_string($conn, $_POST['mail1']);
$phno1 = mysqli_real_escape_string($conn, $_POST['phno1']);
$dept1 = mysqli_real_escape_string($conn, $_POST['dept1']);
$dob1 = mysqli_real_escape_string($conn, $_POST['dob1']);
$gender1 = mysqli_real_escape_string($conn, $_POST['gender1']);
$password1 = mysqli_real_escape_string($conn, $_POST['password1']);
$cpassword1 = mysqli_real_escape_string($conn, $_POST['cpassword1']);
if ($password1 == $cpassword1) {
$sql = "insert into student (usn,name,mail,phno,dept,gender,DOB,pw) values('$usn1','$name1','$mail1','$phno1','$dept1','$gender1','$dob1','$password1')";
if (mysqli_query($conn, $sql)) {
echo "<script>
alert('successful!');
window.location.replace(\"index.php\");</script>";
session_destroy();
} else {
echo "<script>
alert('Data enter by you alreay exist in Database please Sign In');
window.location.replace(\"index.php\");</script>";
session_destroy();
}
} else {
echo "<script>
alert(' Password should be same');
window.location.replace(\"singup.php\");</script>";
session_destroy();
}
}
}
if (isset($_POST['staffsu'])) {
session_start();
if (isset($_POST['name2']) && isset($_POST['staffid']) && isset($_POST['mail2']) && isset($_POST['phno2']) && isset($_POST['dept2']) && isset($_POST['dob2']) && isset($_POST['gender2']) && isset($_POST['password2']) && isset($_POST['cpassword2'])) {
require 'sql.php';
$conn = mysqli_connect($host, $user, $ps, $project); if (!$conn) {
echo "<script>alert(\"Database error retry after some time !\")</script>";
}
$name2 = mysqli_real_escape_string($conn, $_POST['name2']);
$usn2 = mysqli_real_escape_string($conn, $_POST['staffid']);
$mail2 = mysqli_real_escape_string($conn, $_POST['mail2']);
$phno2 = mysqli_real_escape_string($conn, $_POST['phno2']);
$dept2 = mysqli_real_escape_string($conn, $_POST['dept2']);
$dob2 = mysqli_real_escape_string($conn, $_POST['dob2']);
$gender2 = mysqli_real_escape_string($conn, $_POST['gender2']);
$password2 = mysqli_real_escape_string($conn, $_POST['password2']);
$cpassword2 = mysqli_real_escape_string($conn, $_POST['cpassword2']);
if ($password2 == $cpassword2) {
$sql = "insert into staff (staffid,name,mail,phno,dept,gender,DOB,pw) values('$usn2','$name2','$mail2','$phno2','$dept2','$gender2','$dob2','$password2')";
if (mysqli_query($conn, $sql)) {
echo "<script>
alert('successful!');
window.location.replace(\"index.php\");</script>";
session_destroy();
} else {
echo "<script>
alert('Data enter by you alreay exist in Database please Sign In');
window.location.replace(\"index.php\");</script>";
session_destroy();
}
} else {
echo "<script>
alert(' Password should be same');
window.location.replace(\"signup.php\");</script>";
session_destroy();
}
}
}
?>
<body class="bg-white" id="top">
<!-- Navbar -->
<nav
id="navbar-main"
class="
navbar navbar-main navbar-expand-lg
bg-default
navbar-light
position-sticky
top-0
shadow
py-0
"
>
<div class="container">
<ul class="navbar-nav navbar-nav-hover align-items-lg-center">
<li class="nav-item dropdown">
<a href="index.php" class="navbar-brand mr-lg-5 text-white">
<img src="assets/img/navbar.png" />
</a>
</li>
</ul>
<button
class="navbar-toggler bg-white"
type="button"
data-toggle="collapse"
data-target="#navbar_global"
aria-controls="navbar_global"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon text-white"></span>
</button>
<div class="navbar-collapse collapse bg-default" id="navbar_global">
<div class="navbar-collapse-header">
<div class="row">
<div class="col-10 collapse-brand">
<a href="index.html">
<img src="assets/img/navbar.png" />
</a>
</div>
<div class="col-2 collapse-close bg-danger">
<button
type="button"
class="navbar-toggler"
data-toggle="collapse"
data-target="#navbar_global"
aria-controls="navbar_global"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span></span>
<span></span>
</button>
</div>
</div>
</div>
<ul class="navbar-nav align-items-lg-center ml-auto">
<li class="nav-item">
<a href="contact.php" class="nav-link">
<span class="text-white nav-link-inner--text"
><i class="text-white fas fa-address-card"></i> Contact</span
>
</a>
</li>
<li class="nav-item">
<div class="dropdown show ">
<a class="nav-link dropdown-toggle text-white " href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="text-white nav-link-inner--text"
><i class="text-white fas fa-sign-in-alt"></i> Login</span
>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="loginstud.php">Student</a>
<a class="dropdown-item" href="login.php">Staff</a>
</div>
</div>
</li>
<li class="nav-item">
<a href="signup.php" class="nav-link">
<span class="text-success nav-link-inner--text"
><i class="text-success fas fa-user-plus"></i> Sign Up</span
>
</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- End Navbar -->
<section class="section section-shaped section-lg">
<div class="shape shape-style-1 shape-primary">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row">
<div class="col-md-8 mx-auto text-center">
<span class="badge badge-info badge-pill mb-3">Sign Up</span>
</div>
</div>
<div class="row row-content align-text-center text-white ">
<div class="col-12 offset-sm-2 col-sm-8 offset-sm-2 ">
<div class="card card-body bg-dark">
<div class="col-12 ">
<a class="btn btn-danger btn-block" data-toggle="modal" data-target="#teachersignup" ><p>I'm a Teacher</p> </a>
</div>
<br>
<div class="col-12 ">
<a class="btn btn-primary btn-block" data-toggle="modal" data-target="#studentsignup" > <p> I'm a Student</p> </a>
</div>
</div>
</div>
</div>
<!-- Registration Modal Teacher -->
<div id="teachersignup" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg" role="content">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Sign Up as Staff</h4>
<button type="button" class="close" data-dismiss="modal">
×
</button>
</div>
<div class="modal-body bg-gradient-danger">
<form
class="col s12 l5 white-text"
method="POST"
name="staffSIGNUP"
autocomplete="new-password"
>
<div class="form-group row">
<label
for="name"
class="col-md-2 col-form-label text-white"
>Full Name </label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="form-control"
required
placeholder="Name"
id="first_name"
name="name2"
type="text"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label
for="staffid"
class="col-md-2 col-form-label text-white"
>Staff ID</label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="form-control"
required
placeholder="Staff ID"
id="first_name"
name="staffid"
type="text"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="mail2"
>Email</label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="white-text validate form-control"
placeholder="Email Address"
id="email"
name="mail2"
type="email"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="phno2">Phone</label>
<div class="col-md-10">
<input
autocomplete="new-password"
class="white-text form-control"
required
placeholder="Contact Number"
id="phone"
name="phno2"
type="text"
pattern="[6789][0-9]{9}"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label
for="firstname"
class="col-md-2 col-form-label text-white"
for="dept2"
>Department</label
>
<div class="col-md-10">
<select
name="dept2"
id="blood"
class="validate form-control"
required
>
<option value="CSE">CSE</option>
<option value="ISE">ISE</option>
<option value="ECE">ECE</option>
<option value="EEE">EEE</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="dob2"
>Date Of Joining</label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="white-text validate form-control"
placeholder="Date of Birth"
id="email"
name="dob2"
type="date"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label
for="gender2"
class="col-md-2 col-form-label text-white"
for="rh"
>Gender</label
>
<div class="col-3">
<label>
<input
class="form-control"
value="M"
name="gender2"
type="radio"
required
checked
/>
<span class="text-white">Male</span>
</label>
</div>
<div class="col-3">
<label>
<input
class="form-control"
value="F"
name="gender2"
type="radio"
required
/>
<span class="text-white">Female</span>
</label>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="password2"
>Password</label
>
<div class="col-md-10">
<input
type="password"
name="password2"
class=" form-control"
required
placeholder="**********"
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
/>
<p> <small class="text-white"> Use minimum 8 Characters with atleast 1 numericals, Capital letter and Special Character. </small></p>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="cpassword2"
>Confirm Password</label
>
<div class="col-md-10">
<input
type="password"
name="cpassword2"
class=" form-control"
required
placeholder="**********"
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
/>
<p> <small class="text-white"> Enter the same password as before, for verification. </small></p>
</div>
</div>
<div class="form-group row">
<div class="offset-md-2 col-md-10">
<button class="btn btn-success form-control" type="submit" name="staffsu">
Sign Up
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Registration Modal Student -->
<div id="studentsignup" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg" role="content">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Sign Up as Student</h4>
<button type="button" class="close" data-dismiss="modal">
×
</button>
</div>
<div class="modal-body bg-gradient-primary">
<form
class="col s12 l5 white-text"
method="POST"
name="student"
autocomplete="new-password"
>
<div class="form-group row">
<label
for="name1"
class="col-md-2 col-form-label text-white"
>Full Name</label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="form-control"
required
placeholder="Name"
id="first_name"
name="name1"
type="text"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label
for="usn1"
class="col-md-2 col-form-label text-white"
>USN</label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="form-control"
required
placeholder="USN"
id="first_name"
name="usn1"
type="text"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="mail1"
>Email</label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="white-text validate form-control"
placeholder="Email Address"
id="email"
name="mail1"
type="email"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="phno1">Phone</label>
<div class="col-md-10">
<input
autocomplete="new-password"
class="white-text form-control"
required
placeholder="Contact Number"
id="phone"
name="phno1"
type="text"
pattern="[6789][0-9]{9}"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label
for="firstname"
class="col-md-2 col-form-label text-white"
for="dept1"
>Department</label
>
<div class="col-md-10">
<select
name="dept1"
id="blood"
class="validate form-control"
required
>
<option value="CSE">CSE</option>
<option value="ISE">ISE</option>
<option value="ECE">ECE</option>
<option value="EEE">EEE</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="dob1"
>DOB</label
>
<div class="col-md-10">
<input
autocomplete="new-password"
class="white-text validate form-control"
placeholder="Date of Birth"
id="email"
name="dob1"
type="date"
class="validate"
/>
</div>
</div>
<div class="form-group row">
<label
for="gender1"
class="col-md-2 col-form-label text-white"
for="rh"
>Gender</label
>
<div class="col-3">
<label>
<input
class="form-control"
value="M"
name="gender1"
type="radio"
required
checked
/>
<span class="text-white">Male</span>
</label>
</div>
<div class="col-3">
<label>
<input
class="form-control"
value="F"
name="gender1"
type="radio"
required
/>
<span class="text-white">Female</span>
</label>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="password1"
>Password</label
>
<div class="col-md-10">
<input
type="password"
name="password1"
class=" form-control"
required
placeholder="**********"
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
/>
<p> <small class="text-white"> Use minimum 8 Characters with atleast 1 numericals, Capital letter and Special Character. </small></p>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label text-white" for="cpassword1"
>Confirm Password</label
>
<div class="col-md-10">
<input
type="password"
name="cpassword1"
class=" form-control"
required
placeholder="**********"
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
/>
<p> <small class="text-white"> Enter the same password as before, for verification. </small></p>
</div>
</div>
<div class="form-group row">
<div class="offset-md-2 col-md-10">
<button class="btn btn-success form-control" type="submit" name="studsu">
Sign Up
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<?php require("footer.php");?>
</body>
</html>