-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
42 lines (39 loc) · 863 Bytes
/
admin.php
File metadata and controls
42 lines (39 loc) · 863 Bytes
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
<?php
session_start();
if(isset($_REQUEST["Login"]))
{
$user=$_POST["user"];
$pass=$_POST["password"];
$flag=0;
$con=new mysqli("localhost","root","Harshil479","library_project");
$query="select * from admin";
if($sql=mysqli_query($con,$query))
{
while($result=mysqli_fetch_row($sql))
{
if($user==$result[1] && $pass==$result[2])
{
$flag=1;
break;
}
else {
$falg=0;
}
}
$_SESSION['name']=$result[0];
// echo $_SESSION['name'];
if($flag===1)
{
echo "<script type=text/javascript>
location.href='Home.php';
</script>";
}
else {
echo "<script>
alert('Incorrect Password or User_ID');
location.href='admin.html';
</script>";
}
}
}
?>