-
Notifications
You must be signed in to change notification settings - Fork 3
/
adminlogin.php
131 lines (109 loc) · 3.23 KB
/
adminlogin.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
session_start();
?>
<script>
function validateFormad()
{
var y=document.forms["form2"]["Loginid"].value;
var passw = document.forms["form2"]["password"].value;
if (y==null || y=="")
{
alert("Login ID must be filled out");
return false;
}
if (passw==null || passw=="")
{
alert("Password must be filled out");
return false;
}
}
</script>
<?php
include("header.php");
include("slider.php");
include("dbconnection.php");
if(isset($_SESSION["loginid"]))
{
header("Location: adminhome.php");
}
if(isset($_POST["submit"]))
{
$result = mysql_query("SELECT * FROM employees
WHERE loginid='$_POST[Loginid]' AND password='$_POST[password]' AND emptype='Admin'");
if(mysql_num_rows($result) == 1)
{
while($row = mysql_fetch_array($result))
{
$_SESSION["logintype"] = "Admin";
$_SESSION[empid] = $row[empid];
$_SESSION[names] = $row[fname]. " ". $row[lname];
}
$_SESSION["loginid"] = $_POST[Loginid];
header("Location: adminhome.php");
}
else
{
$msg = "Invalid Login ID and Password entered";
}
}
?>
<div id="templatemo_content">
<div id="templatemo_content_left">
<div class="header_02">Administrator Login Page</div>
<div class="image_frame_02"><a href="#"><img src="images/adminlogin.jpg" alt="image" /></a></div>
<p class="bi_para"> </p>
<div class="rc_btn_02"></div>
<div class="margin_bottom_40"></div>
<div >
<?php
if(isset($_SESSION["login"]))
{
echo "You already logged in<br>";
?>
<button onclick="window.location.href='adminhome.php'">Continue</button>
<?php
}
else
{
?>
<form id="form2" name="form2" method="post" action="" onsubmit="return validateFormad()">
<p> <?php echo $msg; ?></p>
<p>
<label for="Loginid" >Login ID</label>
</p>
<p>
<input name="Loginid" type="text" id="Loginid" size="45" />
</p>
<p>
<label for="password">Password<br />
</label>
<input name="password" type="password" id="password" size="45" />
</p>
<p>
<input type="submit" name="submit" id="submit" value="Login here" />
<input type="reset" name="submit2" id="submit2" value="Reset" />
</p>
</form>
<?php
}
?>
<p> </p>
</div>
<div class="cleaner"></div>
</div> <!-- end of content left -->
<div id="templatemo_content_right">
<div class="content_right_section">
<div class="header_02"></div>
<div class="news_section">
<div class="news_image"></div>
</div>
<div class="margin_bottom_20"></div>
<div class="margin_bottom_20"></div>
<div class="margin_bottom_20"></div>
</div>
</div> <!-- end of content right -->
<div class="cleaner"></div>
</div>
<?php
include("footer.php");
?>