-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
245 lines (215 loc) · 12.2 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?php
include 'config.php';
//session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/login.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- sweet alert -->
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<!-- aos animation -->
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<!-- loading bar -->
<script src="https://cdn.jsdelivr.net/npm/pace-js@latest/pace.min.js"></script>
<link rel="stylesheet" href="css/flash.css">
<title>Hotel</title>
</head>
<body>
<!-- carousel -->
<section id="carouselExampleControls" class="carousel slide carousel_section" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="carousel-image" src="./image/__hotel1.jpg">
</div>
<div class="carousel-item">
<img class="carousel-image" src="./image/__hotel2.jpg">
</div>
<div class="carousel-item">
<img class="carousel-image" src="./image/__hotel3.jpg">
</div>
</div>
</section>
<!-- main section -->
<section id="auth_section">
<div class="logo">
<p>Hotel</p>
</div>
<div class="auth_container">
<div id="Log_in">
<h2>Log In</h2>
<br/>
<span>
<div class="role_btn">
<div class="btns active">User</div>
<div class="btns">Admin</div>
</div>
</span>
<!-- User Login ,SignUp-->
<?php
if (isset($_POST['user_login_submit'])) {
$Email = $_POST['Email'];
$Password = $_POST['Password'];
$sql = $conn->query("SELECT * FROM signup WHERE Email = '$Email' AND Password = '$Password'");
$sql->execute();
$result = $sql->fetchAll(PDO::FETCH_ASSOC);
if ($result) {
$_SESSION['usermail']=$Email;
$Email = "";
$Password = "";
header("Location: home.php");
} else {
echo "<script>swal({
title: 'Something went wrong',
icon: 'error',
});
</script>";
}
}
?>
<form class="user_login authsection active" id="userlogin" action="" method="POST">
<div class="form-floating">
<input type="text" class="form-control" name="Username" placeholder=" ">
<label for="Username">Username</label>
</div>
<div class="form-floating">
<input typuser_logine="email" class="form-control" name="Email" placeholder=" ">
<label for="Email">Email</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" name="Password" placeholder=" ">
<label for="Password">Password</label>
</div>
<button type="submit" name="user_login_submit" class="auth_btn">Log in</button>
<div class="footer_line">
<h6>Don't have an account? <span class="page_move_btn" onclick="signuppage()">sign up</span></h6>
</div>
</form>
<!-- Employee Login-->
<?php
if (isset($_POST['Emp_login_submit'])) {
$Email = $_POST['Emp_Email'];
$Password = $_POST['Emp_Password'];
$sql = $conn->query("SELECT * FROM emp_login WHERE Emp_Email = '$Email' AND Emp_Password = '$Password'");
$result = $sql->execute();
$sql->fetchAll(PDO::FETCH_ASSOC);
if($result){
$_SESSION['usermail']=$Email;
$Email = "";
$Password = "";
header("Location: admin/admin.php");
} else {
echo "<script>swal({
title: 'Something went wrong',
icon: 'error',
});
</script>";
}
}
?>
<form class="employee_login authsection" id="employeelogin" action="" method="POST">
<div class="form-floating">
<input type="email" class="form-control" name="Emp_Email" placeholder=" ">
<label for="floatingInput">Email</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" name="Emp_Password" placeholder=" ">
<label for="floatingPassword">Password</label>
</div>
<button type="submit" name="Emp_login_submit" class="auth_btn">Log in</button>
</form>
</div>
<?php
if (isset($_POST['user_signup_submit'])) {
$Username = $_POST['Username'];
$Email = $_POST['Email'];
$Password = $_POST['Password'];
$CPassword = $_POST['CPassword'];
if ($Username == "" || $Email == "" || $Password == "") {
echo "<script>swal({
title: 'Fill the proper details',
icon: 'error',
});
</script>";
}else if($Password == $CPassword) {
$sql = $conn->query("SELECT * FROM signup WHERE Email = '$Email' AND Password = '$Password'");
$sql->execute();
$result = $sql->fetchAll(PDO::FETCH_ASSOC);
if ($result) {
echo "<script>swal({
title: 'Email already exist',
icon: 'error',
});
</script>";
} else {
//$id = $_SESSION['UserID'];
//$sql = $conn->query("INSERT INTO signup VALUES ('','$Username', '$Email', '$Password')");
$result = $conn->prepare("INSERT INTO signup VALUES ('','$Username', '$Email', '$Password')")->execute();
if ($result) {
$_SESSION['usermail']=$Email;
//$id = "";
$Username = "";
$Email = "";
$Password = "";
$CPassword = "";
header("Location: home.php");
} else {
echo "<script>swal({
title: 'Something went wrong',
icon: 'error',
});
</script>";
}
}
} else {
echo "<script>swal({
title: 'Password does not matched',
icon: 'error',
});
</script>";
}
}
?>
<div id="sign_up">
<h2>Sign Up</h2>
<form class="user_signup" id="usersignup" action="" method="POST">
<div class="form-floating">
<input type="text" class="form-control" name="Username" placeholder=" ">
<label for="Username">Username</label>
</div>
<div class="form-floating">
<input type="email" class="form-control" name="Email" placeholder=" ">
<label for="Email">Email</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" name="Password" placeholder=" ">
<label for="Password">Password</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" name="CPassword" placeholder=" ">
<label for="CPassword">Confirm Password</label>
</div>
<button type="submit" name="user_signup_submit" class="auth_btn">Sign up</button>
<div class="footer_line">
<h6>Already have an account? <span class="page_move_btn" onclick="loginpage()">Log in</span>
</h6>
</div>
</form>
</div>
</section>
</body>
<script src="./javascript/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<!-- aos animation-->
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
<script>
AOS.init();
</script>
</html>