-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration_done.php
63 lines (59 loc) · 1.67 KB
/
registration_done.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
<?php
session_start();
include("insert_data.php");
include("get_all_data.php");
extract($_REQUEST);
function filter_data($variable){
$variable=htmlspecialchars(stripslashes(trim($variable)));
return $variable;
}
if (isset($submit))
if($submit=='Register'){
$stud_name=filter_data($stu_name);
$stud_email=filter_data($stu_email);
$stu_pass=filter_data($stu_pass);
$stu_pass=md5($stu_pass);
$stud_qual=filter_data($stu_qual);
$stud_contact=filter_data($stu_contact);
if(!preg_match("/^[0-9]{10}$/", $stud_contact)){
header('Location:error_page.php?err=2');
exit();
}
$students=get_students();
while($student=get_assoc($students))
if($stud_email==$student['stu_email']){
header('Location:error_page.php?err=1');
exit();
}
$employers=get_employers();
while($employer=get_assoc($employers)){
if($stud_email==$employer['emp_email']){
header('Location:error_page.php?err=104');
exit();
}
}
insert_students($stud_name,$stud_email,$stu_pass,$stud_qual,$stud_contact);
}
if(isset($submit2))
if($submit2=='Register'){
$emp_name=filter_data($emp_name);
$emp_email=filter_data($emp_email);
$emp_pass=filter_data($emp_pass);
$emp_pass=md5($emp_pass);
$emp_addr=filter_data($emp_addr);
$employers=get_employers();
while($employer=get_assoc($employers)){
if($emp_email==$employer['emp_email'])
header('Location:error_page.php?err=1');
exit();
}
$students=get_students();
while($student=get_assoc($students))
if($emp_email==$student['stu_email']){
header('Location:error_page.php?err=105');
exit();
}
insert_employers($emp_name,$emp_email,$emp_pass,$emp_addr);
}
header('Location:index.php');
?>