-
Notifications
You must be signed in to change notification settings - Fork 1
/
guest-login.php
executable file
·105 lines (72 loc) · 2.19 KB
/
guest-login.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
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
<?php
session_start();
if(isset($_SESSION['uid']) || isset($_SESSION['user']))
{
header('location:room-display.php');
}
include ('admin/dbcon.php');
if(isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$password_hash=md5($password);
$query = "SELECT * FROM `guest_record` WHERE `username`='$username' AND `password`='$password_hash'";
$run = mysqli_query($con, $query);
if (mysqli_num_rows($run) > 0) {
$data = mysqli_fetch_assoc($run);
$id = $data['id'];
$username = $data['username'];
$_SESSION['uid']=$id;
$_SESSION['user']=$username;
header('location:room-display.php');
exit;
} else {
?>
<script>
alert('Username And Password Doesn\'t Match');
window.open('guest-login.php', '_self');
</script>
<?php
}
}
?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html"charset="UTF-8"/>
<link rel="stylesheet" type="text/css" href="css/guest.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>Guest-Login</title>
</head>
<body>
<?php
/**
* Created by PhpStorm.
* User: prajjwal
* Date: 2/9/18
* Time: 8:17 AM
*/
include('header.php');
include ('admin/dbcon.php');
$query="SELECT * FROM `logo` WHERE `id`='3'";
$run=mysqli_query($con,$query);
$data=mysqli_fetch_assoc($run);
?>
<div class="guest">
<?php echo '<img class="avatar" src="images/'.$data['image'].'" height="80px" width="80px" />';?>
<h1>Guest-Login</h1>
<form action="guest-login.php" method="post">
<p>Username:</p>
<input type="text" name="username" placeholder="Enter your username" required>
<p>Password:</p>
<input type="password" name="password" placeholder="Enter your password" required>
<input type="submit" name="submit" value="Login"><br>
</form>
<a href="forget-user-pass.php"><h3>Forgot your password??</h3></a>
<h4>Dont have account?</h4>
<a href="user-reg.php"><h3>Register Now</h3></a>
</div>
<?php
include('footer.php');
?>
</body>
</html>