-
Notifications
You must be signed in to change notification settings - Fork 0
/
admincheck.php
41 lines (38 loc) · 905 Bytes
/
admincheck.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
<?php
session_start();
$username=$_POST['username'];
$password=$_POST['password'];
$conn=mysql_connect("localhost","root","") or die("Could not connect!");
mysql_select_db("dbms") or die("Could not find db");
$query=mysql_query("SELECT * FROM admin WHERE username='$username'");
$numrows=mysql_num_rows($query);
if($numrows!=0){
while($row=mysql_fetch_assoc($query)){
$dbpassword=$row['password'];
}
if($password==$dbpassword){
$_SESSION['username']=$username;
header("Location: adminhome.php");
exit();
}
else
{
?>
<script type="text/javascript">
alert("Incorrect password");
window.location.href="adminlogin.php";
</script>
<?php
}
}
else
{
?>
<script type="text/javascript">
alert("Invaild user");
window.location.href="adminlogin.php";
</script>
<?php
}
mysql_close($conn);
?>