forked from shashikumarHC/laboratorymanagementststem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
72 lines (69 loc) · 2.06 KB
/
main.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="main">
<div class="left">
<h1>My Library</h1>
</div>
<form action="" method="post">
<div class="right">
<h1>Login</h1>
<div class="name" >
<label for="name">Name</label>
<input type="text" name="name">
</div>
<div class="password">
<label for="password">password</label>
<input type="password" name="password">
</div>
<div class="but">
<button type="submit">submit</button>
</div>
</div>
<?php
$mysql=new mysqli("localhost","root","","acharya") or die(mysqli_error($mysql));
$name="";
$password="";
$host="";
$a="";
if($_SERVER['REQUEST_METHOD']=="POST")
{
$name=$_POST['name'];
$password=$_POST['password'];
}
$result=$mysql->query("SELECT * FROM uname WHERE fname LIKE '%$name%'") or "NULL";
if(!empty($name)) {
if($result-> num_rows> 0)
{
while($row = $result->fetch_assoc())
{
$a=$row["fname"];
}
}
if($name=='shashi'&& $password==1234)
{
header('Location:lib.php');
$host="admin";
}
elseif($a==$name && $password==1234)
{
header('Location:lab.php');
$host="user";
}
elseif($a!=$name || $password!=1234){
header('Location:askadmin.php');
}
session_start();
$_SESSION['host']=$host;
?>
<?php } ?>
</form>
</div>
</body>
</html>