-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
105 lines (94 loc) · 2.85 KB
/
index.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
<?php
session_start();
include("includes/connect.php");
include("includes/banner.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>SRIS</title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/sindex.css" media="all">
<script src="bootstrap/js/bootstrap.min.js"></script>
<style>
#fter{background-color: #5cb85c;height:40px;margin-top: 430px;text-align: center;
position: fixed;z-index: 1px;width: 1200px;color:white;padding-bottom: 10px;
}
</style>
</head>
<br /><br />
<body>
<div id="cent" >
 
<div id="cen" style="margin-left:28%; color: #5cb85c"><br /><br /><br /><br />
<form method="POST" class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-3">Username</label>
<div class="col-sm-8">
<input style="border-color: #5cb85c;" type="text" name="uname" class="form-control" placeholder="Your username" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Password</label>
<div class="col-sm-8">
<input style="border-color: #5cb85c;" type="password" name="pass" class="form-control" placeholder="Your username" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-9">
<input type="submit" name="login" value="Login" class="btn btn-success">
</div>
</div>
</div>
</div>
</form>
</div>
 
</body>
<?php
include("includes/footer.php");
?>
</html>
<?php
if (isset($_POST['login'])) {
$ab=$_POST['uname'];
$bc=$_POST['pass'];
$a=mysqli_real_escape_string($conn,$ab);
$b=mysqli_real_escape_string($conn,$bc);
$sql="SELECT *FROM itmanager WHERE username='$a' AND password='$b'";
$exex=mysqli_query($conn,$sql);
$slq1=mysqli_query($conn,"SELECT *FROM teachers where username='$a' and password='$b'");
$sqls=mysqli_query($conn,"SELECT *FROM students WHERE username='$a' AND password='$b'");
$sd=mysqli_query($conn,"SELECT *FROM dean where username='$a' and password='$b'");
$sw=mysqli_query($conn,"SELECT *FROM displine WHERE username='$a' and password='$b'");
if (mysqli_num_rows($sw)) {
$row=mysqli_fetch_array($sw);
$_SESSION['disp']=$row['d_id'];
header("location:dishome.php");
}
if (mysqli_num_rows($exex)>0) {
$row=mysqli_fetch_array($exex);
$_SESSION['it']=$row['username'];
header("location:adminreg.php");
}
if (mysqli_num_rows($slq1)>0) {
$row=mysqli_fetch_array($slq1);
$_SESSION['teacher']=$row['t_id'];
header("location:tehome.php");
}
if (mysqli_num_rows($sqls)>0) {
$row=mysqli_fetch_array($sqls);
$_SESSION['s_id']=$row['s_id'];
$_SESSION['password']=$row['password'];
header("location:studentspage.php");
}
if (mysqli_num_rows($sd)>0) {
$row=mysqli_fetch_array($sd);
$_SESSION['deanp']=$row['id'];
header("location:adminpage.php");
}
if (!$exex && !$slq1 && !$sqls && $sd && !$sw) {
echo "<script>alert('no matching')</script>";
}
}
?>