-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathadmin.php
140 lines (129 loc) · 3.42 KB
/
admin.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
132
133
134
135
136
137
138
139
140
<?php
/**
* @System HP-pc Rax
* @author Rakshit shah <Rakshitshah1994@gmail.com>
* @copyright 2015-2017 |Rakshit shah
* @license http://rakshit.in/license/license.php | PHP License 3.0
* @version 1.1
* @since File available since Release 1.0.0
*/
session_start();
//echo $_SESSION["uid"];
if(isset($_SESSION["userid"]))
{
if($_SESSION["type"]=="admin")
{
header("Location: dashboard.php");
}
else
{
header("Location: lectureaccount.php");
}
}
include("header.php");
include("conection.php");
if(isset($_POST["uid"]) && isset($_POST["pwd"]) )
{
// echo "sdfsd". $_POST[uid];
$result = mysql_query("SELECT * FROM administrator WHERE adminid='$_POST[uid]'");
while($row = mysql_fetch_array($result))
{
$pwdmd5 = $row["password"];
}
if(md5($_POST["pwd"])==$pwdmd5)
{
$_SESSION["userid"] = $_POST["uid"];
$_SESSION["type"]="admin";
header("Location: dashboard.php");
}
else
{
$log = "Login failed.. Please try again..";
}
}
if(isset($_POST["luid"]) && isset($_POST["lpwd"]))
{
$result = mysql_query("SELECT * FROM lectures WHERE lecid='$_POST[luid]'");
while($row = mysql_fetch_array($result))
{
$pwdm= $row["password"];
$_SESSION["lecname"] = $row["lecname"];
$_SESSION["coid"] = $row["courseid"];
}
//echo"pwd". md5($_POST["lpwd"]);
if(md5($_POST["lpwd"])==$pwdm)
{
//echo $_POST["lpwd"];
$_SESSION["userid"] = $_POST["luid"];
$_SESSION["type"]=="lecturer";
header("Location: lectureaccount.php");
}
else
{
$log12 = "Login failed.. Please try again..";
}
}
?>
<section id="page">
<header id="pageheader" class="normalheader">
<h2 class="sitedescription">
</h2>
</header>
<section id="contents">
<article class="post">
<header class="postheader">
<h2><u>Admin Login</u></h2>
<h2><?php echo $log;?></h2>
</header>
<section class="entry">
<form action="admin.php" method="post" class="form">
<p class="textfield">
<label for="author">
<small>Admin Login ID (required)</small>
</label>
<input name="uid" id="uid" value="" size="22" tabindex="1" type="text">
</p>
<p class="textfield">
<label for="email">
<small>Password (required)</small>
</label>
<input name="pwd" id="pwd" value="" size="22" tabindex="2" type="password">
</p>
<p>
<input name="submit" id="submit" tabindex="5" type="image" src="images/submit.png">
<input name="comment_post_ID" value="1" type="hidden">
</p>
<div class="clear"></div>
</form>
<form action="admin.php" method="post" class="form">
<div class="clear">
<hr />
<header class="postheader">
<h2><u>Lectures Login</u></h2>
<h2><?php echo $log12;?></h2>
</header>
<section class="entry">
<p class="textfield">
<label for="author2"> <small><br />
Lecture Login ID (required)</small> </label>
<input name="luid" id="luid" value="" size="22" tabindex="3" type="text" />
</p>
<p class="textfield">
<label for="email2"> <small>Password (required)</small> </label>
<input name="lpwd" id="lpwd" size="22" tabindex="4" type="password" />
</p>
<p>
<input name="submit2" id="submit2" tabindex="5" type="image" src="images/submit.png" />
<input name="comment_post_ID2" value="1" type="hidden" />
</p>
<div class="clear"></div>
</form>
<div class="clear"></div>
</section>
</div>
</section>
</article>
</section>
<?php
include("adminmenu.php");
include("footer.php"); ?>