/
admin_entry.php
89 lines (83 loc) · 1.96 KB
/
admin_entry.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
<html>
<head>
<link rel="stylesheet" href="screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="print.css" type="text/css" media="print">
<!--[if IE]><link rel="stylesheet" href="ie.css" type="text/css" media="screen, projection"><![endif]-->
</head>
<div class="container showgrid">
<?php
session_start();
$username=$_POST['username'];
$password=$_POST['password'];
if($username && $password)
{
$link = mysql_connect('localhost', 'root', ''); //changet the configuration in required
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('test1');
$query="SELECT * FROM supplier WHERE username='$username'";
$result=mysql_query($query) or die(mysql_error());
$numrows=mysql_num_rows($result);
if($numrows!=0)
{
while($row=mysql_fetch_array($result))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
//check to see if they match
if($username==$dbusername&&$password==$dbpassword)
{
echo "Welcome supplier<br>";
$_SESSION['username1']=$dbusername;
echo "You are in ! <a href='supplier_member.php'>Click</a> here to go the member page";
$query1=mysql_query("SELECT id from supplier WHERE username='$username'");
$numrows1=mysql_num_rows($query1) or die(mysql_error());
if($numrows1!=0)
{
while($row1=mysql_fetch_array($query1))
{
$sid=$row1['id'];
$_SESSION['sid']=$sid;
}
}
}
else
{
echo "Incorrect password";
}
}
else
{
$query="SELECT * FROM superuser WHERE username='$username'";
$result=mysql_query($query) or die(mysql_error());
$numrows=mysql_num_rows($result);
if($numrows!=0)
{
while($row=mysql_fetch_array($result))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
//check to see if they match
if($username==$dbusername&&$password==$dbpassword)
{
echo "Welcome Superuser!! ";
$_SESSION['username2']=$dbusername;
echo "You are in! <a href='superuser_member.php'>Click</a> here to go the member page";
}
else
{
echo "Incorrect password";
}
}
}
}
else
{
die("Please enter all the details!");
}
?>
</div>
</html>