-
Notifications
You must be signed in to change notification settings - Fork 0
/
customerlogin.php
51 lines (45 loc) · 1.21 KB
/
customerlogin.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<title>Customer's Login Page</title>
</head>
<body class="centered">
<?php
include "config.php";
$conn -> select_db("heroku_ed39a20fb4d6fd8");
session_start();
if(isset($_POST["username"]) && isset($_POST["password"])){
$username = $_POST["username"];
$password = $_POST["password"];
$que = mysqli_query($conn,"SELECT * FROM customers WHERE username='$username' AND password='$password'");
$num_rows = mysqli_num_rows($que);
if ($num_rows == 1){
$_SESSION["username"] = $username;
$_SESSION["password"] = $password;
} else {
echo "Invalid username and password combination.<br>Redirecting to Customer's Login Page.";
?>
<script>
setTimeout(function() {
window.location.href="customerlogin.html";
}, 3000);
</script>
<?php
}
} else {
echo "Please fill the fields.";
}
if(isset($_SESSION["username"])){
echo "Authentication Success" ."<br>". "Redirecting to Customer's first page.";
?>
<script>
setTimeout(function() {
window.location.href="customerwithlogin2.php";
}, 3000);
</script>
<?php
}
?>
</body>
</html>