forked from sujay-mahadik/student-erp-by-ssa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump.txt
executable file
·150 lines (116 loc) · 3.78 KB
/
dump.txt
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
if($year == "fe"){
if($dept == "civil"){
$extid = date('y')."1";
$maxidsql = mysqli_query($conn, "SELECT MAX(id) AS maxid FROM fecivil");
$row = mysqli_fetch_assoc($maxidsql);
$maxid = $row['maxid']+"1";
$maxid_padded = sprintf("%03d", $maxid);
$sql = "INSERT INTO fecivil (userid,password,fname,mname,lname) VALUES (concat('$extid','$maxid_padded'),'$password','$fname','$mname','$lname')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully at $extid$maxid_padded";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
elseif ($dept == "computer") {
$extid = date('y')."2";
$maxidsql = mysqli_query($conn, "SELECT MAX(id) AS maxid FROM fecomp");
$row = mysqli_fetch_assoc($maxidsql);
$maxid = $row['maxid']+"1";
$sql = "INSERT INTO fecomp (userid,password,fname,mname,lname) VALUES (concat('$extid','$maxid'),'$password','$fname','$mname','$lname')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully at $extid$maxid";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
# code...
}
elseif ($dept == "it") {
$extid = date('y')."3";
$maxidsql = mysqli_query($conn, "SELECT MAX(id) AS maxid FROM feit");
$row = mysqli_fetch_assoc($maxidsql);
$maxid = $row['maxid']+"1";
$sql = "INSERT INTO feit (userid,password,fname,mname,lname) VALUES (concat('$extid','$maxid'),'$password','$fname','$mname','$lname')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully at $extid$maxid";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
# code...
}
}
else {
$sql = "SELECT * FROM fecivil where userid='$id' and password='$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
session_start();
$_SESSION['id']=$id;
$_SESSION['asi'] = 1;
$row = mysqli_fetch_array($result);
$_SESSION['username']=$row['fname']." ".$row['mname']." ".$row['lname'];
header("Location: student-index.php");
}
else {
$sql = "SELECT * FROM fecomp where userid='$id' and password='$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
session_start();
$_SESSION['id']=$id;
$_SESSION['asi'] = 1;
$row = mysqli_fetch_array($result);
$_SESSION['username']=$row['fname']." ".$row['mname']." ".$row['lname'];
header("Location: student-index.php");
}
else{
$sql = "SELECT * FROM feit where userid='$id' and password='$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
session_start();
$_SESSION['id']=$id;
$_SESSION['asi'] = 1;
$row = mysqli_fetch_array($result);
$_SESSION['username']=$row['fname']." ".$row['mname']." ".$row['lname'];
header("Location: student-index.php");
}
else{
$sql = "SELECT * FROM teacher where id='$id' and password='$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
session_start();
$_SESSION['ati'] = 1;
$_SESSION['id']=$id;
$row = mysqli_fetch_array($result);
$_SESSION['username']=$row['fname'];
$sql = "SELECT * FROM users ";
$result = $conn->query($sql);
$_SESSION['users']=$result->num_rows;
header("Location: teacher-index.php");
}
else{
session_start();
$_SESSION['login-error'] = '*invalid details';
header("Location: login-index.php");
}
}
}
$result = $conn->query("SHOW TABLES from erp");
$tables="";
$i=0;
while ($row = mysqli_fetch_array($result)) {
$tables = $row[$i];
$search_sql = "SELECT * FROM `{$tables}` where userid='$id' and password='$password'";
$search_result = $conn->query($search_sql);
if ($search_result->num_rows > 0) {
$table_found = $tables;
}
}
$table_found_sql = "SELECT * FROM `{$table_found}` where userid='$id' and password='$password'";
$table_found_result = $conn->query($table_found_sql);
if ($table_found_result->num_rows > 0) {
session_start();
$_SESSION['id']=$id;
$_SESSION['asi'] = 1;
$row = mysqli_fetch_array($table_found_result);
$_SESSION['username']=$row['fname']." ".$row['mname']." ".$row['lname'];
header("Location: student-index.php");
}