-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp.php
executable file
·117 lines (108 loc) · 2.34 KB
/
temp.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
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
include('db.php');
$user=$_POST['t1'];
$pwd=md5($_POST['t2']);
$acc=($_POST['account_type']);
$sql="select * from users where username='$user' and password='$pwd'";
$res=mysql_query($sql,$con);
if($r=mysql_fetch_array($res))
{
if($acc=="admin")
{
session_start();
$_SESSION['username']=$r[0];
header('location:adminhome.php');
}
else if($acc=="manager")
{
session_start();
$_SESSION['username']=$r[0];
$sql="select branch from managerdetails where username='$user'";
$res1=mysql_query($sql,$con);
$r1=mysql_fetch_array($res1);
$_SESSION['branch']=$r1[0];
header('location:managerhome.php');
}
else if($acc=="customer")
{
if($r[4]=="active")
{
session_start();
$_SESSION['username']=$r[0];
header('location:userhome.php');
}
else
{
?>
<script language="javascript">
alert("Waiting for manager to approve.Please login later....");
window.location="loginpage.php";
</script>
<?php
}
}
}
else
{
?>
<script language="javascript">
alert("Invalid Username/Password");
window.location="loginpage.php";
</script>
<?php
}
?>
<?php
include('db.php');
$user=$_POST['t1'];
$pwd=md5($_POST['t2']);
$acc=($_POST['account_type']);
echo $sql="select * from users where username='$user' and password='$pwd' where type = '$acc'";
$res=mysql_query($sql,$con);
if($r=mysql_fetch_array($res))
{
if($acc=="admin")
{
session_start();
$_SESSION['username']=$r[0];
header('location:adminhome.php');
}
else if($acc=="manager")
{
session_start();
$_SESSION['username']=$r[0];
$sql="select branch from managerdetails where username='$user'";
$res1=mysql_query($sql,$con);
$r1=mysql_fetch_array($res1);
$_SESSION['branch']=$r1[0];
header('location:managerhome.php');
}
else if($acc=="customer")
{
if($r[4]=="active")
{
session_start();
$_SESSION['username']=$r[0];
header('location:userhome.php');
}
else
{
?>
<script language="javascript">
alert("Waiting for manager to approve.Please login later....");
window.location="loginpage.php";
</script>
<?php
}
}
}
else
{
?>
<script language="javascript">
alert("Invalid Username/Password");
//window.location="loginpage.php";
</script>
<?php
}
?>