forked from ashish3x3/university-management-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login_db.php
42 lines (42 loc) · 1 KB
/
login_db.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
<? ini_set('error_reporting', E_ALL ^ ~E_NOTICE ^ ~E_WARNING);
session_start();
ob_start();
include("./config.php");
include("./function.php");
$user=$_POST['user'];
$pass=$_POST['pass'];
$category=$_POST['category'];
if($category=="student")
{
$result=mysql_query("select * from student where studloginid='$user'");
$row=mysql_fetch_array($result);
if($row['studpassword']==$pass)
{
$_SESSION['cuser']=$user;
$_SESSION['role']=$category;
$_SESSION['sem']=$row['studsemester'];
login_log($user);
header("location: ./student/home.php");
}
else
{
header("location: ./index.php?msg=Invalid Username or Password");
}
}
else
{
$result=mysql_query("select * from staff where staffloginid='$user'");
$row=mysql_fetch_array($result);
if($row['staffpassword']==$pass)
{
$_SESSION['cuser']=$user;
chk_admin($user);
login_log($user);
header("location: ./staff/home.php");
}
else
{
header("location: ./index.php?msg=Invalid Username or Password");
}
}
?>