-
Notifications
You must be signed in to change notification settings - Fork 2
/
login.php
65 lines (47 loc) · 1.03 KB
/
login.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
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
</head>
<body>
<?php
session_start();
include 'include/connection.php';
$username=$_POST['username'];
$pwd=md5($_POST['password']);
$db=new Database();
$db->connect();
$confirm= $db->run_query("SELECT * from user_detail");
$count=0;
while($row=mysqli_fetch_array($confirm))
{
if($row['username']==$username)
{
if($row['pwd']==$pwd)
{
// $_SESSION['user']=$row['us_name'];
$_SESSION['role']=$row['user_type'];
$_SESSION['user']=$row['username'];
$_SESSION['regno']=$row['reg'];
$_SESSION['dept']='IT';
$_SESSION['no_of_pr']=2;
$count=1;
}
}
}
$db->disconnect();
if($count==0)
{
echo "incorrect username or password";
}
else if($_SESSION['role']=='PC')
{
// echo "welcome\t".$_SESSION['user'];
include 'user/prj_cord.php';
}
else if($_SESSION['role']=="ST")
{
include 'user/student.php';
}
?>
</body>
</html>