-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
73 lines (69 loc) · 2.15 KB
/
index.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
<?php
session_start();
include_once './dbconfig.php';
if(isset($_SESSION['username'])){
header('location: home.php');
}
if(isset($_POST['login'])){
$usr=$_POST['username'];
$pwd=$_POST['password'];
$ret=mysqli_query( $con, "SELECT * FROM users WHERE username='$usr' AND password='$pwd' ");
$row = mysqli_fetch_assoc($ret);
if(!$row) {
?>
<script>
alert("Username or Password Invaild !");
window.open("./index.php","_self")
</script>
<?php
}
else {
$_SESSION['username']=$usr;
?>
<script>
alert("Login Successful!");
window.open("./home.php","_self")
</script>
<?php
}
}
?>
<html>
<head>
<title>BUS RESERVATION SYSTEM</title>
<link rel='stylesheet' href='w3.css'>
<link rel='stylesheet' href='my.css'>
</head>
<body>
<ul class="topnav">
<li><a href="./index.php" class="w3-bar-item w3-button w3-red">Bus Bookings</a></li>
<li><a href="./admin/admin.php" class="w3-bar-item w3-button">Admin Login</a></li>
<li><a href="./status.php" class="w3-bar-item w3-button">Ticket Status</a></li>
<li class="right"><a href="./index.php" class="w3-bar-item w3-button w3-blue">Login</a></li>
<li class="right"><a href="./signup.php">Signup</a></li>
</ul>
<br>
<div class='w3-container w3-card-4 w3-white w3-round' style="height: 400px;width: 320px;margin-top: 80px;margin-left:100px;margin-right:100px;">
<h4>Login To Continue</h4><hr>
<form method='POST' action='<?php echo htmlentities($_SERVER['PHP_SELF']); ?>'>
<label for='username'>Username</label>
<input type='text' name='username'class='w3-input' required></input><br>
<label for='password'>Password</label>
<input type='password' name='password' class='w3-input' required></input><br>
<button type='submit' name='login' class='w3-button w3-blue w3-round'>Login</button>
</form>
</div>
<style>
body{
background-image: url('./static/bk.jpg');
background-repeat: no-repeat;
background-size: cover;
}
</style>
</body>
<footer>
<div class="foot w3-center" style="margin-top:200px;">
<span>Book my Bus © 2021</span>
</div>
</footer>
</html>