-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
57 lines (56 loc) · 1.37 KB
/
index.php
File metadata and controls
57 lines (56 loc) · 1.37 KB
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
<?php
session_start();
if(isset($_SESSION['uname1'])){
header("location:home.php");
}
?>
<?php
$sql=mysqli_connect("localhost","root","","library");
if (isset($_POST['login'])){
$query="select * from login where uname='$_POST[uname]'";
$result = mysqli_query($sql,$query);
if(mysqli_num_rows($result)){
while($row=mysqli_fetch_assoc($result)){
if ($_POST['uname']==$row['uname'] && $_POST['pass']==$row['pass']) {
$_SESSION['uname1']=$_POST['uname'];
header("location:home.php");
}
else{
echo("INVALID PASSSWORD");
}
}
}
else{
echo("INVALID USERNAME");
}
}
?>
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>LMS-Library Management System</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
.j1{
/*background-color:#4842f4;*/
}
</style>
</head>
<body>
<center>
<h2>Welcome to Library Management System</h2>
<div class="row">
<div class="col-sm-12">
<form method="POST">
USERNAME: <input type="text" name="uname" placeholder="Enter Your Username" autofocus required>
<br> <br>
PASSWORD: <input type="text" name="pass" placeholder="Enter Your Password" required>
<br><br>
<input type="submit" name="login">
</form>
</div>
</div>
</div>
</center>
</body>
</html>