-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhall.php
More file actions
124 lines (71 loc) · 2.4 KB
/
hall.php
File metadata and controls
124 lines (71 loc) · 2.4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php require_once('inc/header.php') ;
session_start();
if(isset($_POST['login'])){
$username=$_POST['username'] ;
$password=$_POST['password'] ;
$query="select * from users where username='$username'" ;
$result=mysqli_query($conn,$query);
if(mysqli_num_rows($result)>0){
$row=mysqli_fetch_array($result) ;
$db_username=$row['username'] ;
$db_password=$row['password'] ;
if($username==$db_username && $password==$db_password){
$_SESSION['name']=$db_username;
header("location: login.php") ;
}
else{
$error="Invalid Username or Password" ;
}
}
else{
$error="Invalid Username or Password" ;
}
}
?>
<body id="home">
<!-- Main-Section -->
<?php
if(isset(($_SESSION['name']))){
require_once('inc/nav2.php') ;
}
else{
require_once('inc/navbar.php') ;
}
?>
</body>
</html>
<div class="modal fade text-dark" id="loginModal">
<div class="modal-dialog">
<div class="modal-content">
<form method="post">
<div class="modal-header">
<h5 class="modal-title" id="contactModalTitle">Log In</h5>
<button class="close" data-dismiss="modal"><span>×</span></button>
</div>
<div class="modal-body">
<center>
<?php
if(isset($error)){
echo "<span style='color:red;'>$error</span>";
}
?>
</center>
<div class="form-group">
<label for="name">Username</label>
<input type="text" class="form-control" name="username">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" name="password">
</div>
</div>
<div class="modal-footer">
<input type="submit" class="btn btn-info btn-block" name="login" value="Log in">
</div>
</form>
</div>
</div>
</div>
<?php
require_once('inc/footer.php') ;
?>