-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
75 lines (65 loc) · 2.4 KB
/
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
<?php include "classes.php" ?>
<?php
/**
* Created by PhpStorm.
* User: Rob
* Date: 12/9/2017
* Time: 1:04 AM
*/
$errorMessage = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
isset($_POST["email"]) && $_POST["email"] != "" ? $email = $_POST["email"] : $returnVal = false;
isset($_POST["password"]) && $_POST["password"] != "" ? $password = $_POST["password"] : $returnVal = false;
$success = Authentication::customerLogin($email,$password);
if ($success)
{
header("location: index.php");
}
else
{
$validationMsg = "Incorrect username or password. Try again.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<?php include "head.php" ?>
<body class="bg-dark" id="page-top">
<?php include "navbar.php" ?>
<div class="container">
<?php if(isset($validationMsg)) { ?>
<div class="alert alert-danger alert-dismissible fade show mx-auto mt-5" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4> <?php echo $validationMsg; ?> </h4>
</div>
<?php } ?>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">
<div class="card mx-auto mt-5">
<div class="card-header">Customer Login</div>
<div class="card-body">
<form method="post">
<div class="form-group">
<label for="exampleInputEmail1">Email</label>
<input class="form-control" id="email" name="email" type="email" aria-describedby="emailHelp" placeholder="Email Address">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input class="form-control" id="password" name="password" type="password" placeholder="Password">
</div>
<button type="submit" class="btn btn-primary btn-block">Login</button>
</form>
<div class="text-center">
<a class="d-block small mt-3" href="create-customer.php">Create Customer</a>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include "scripts.php" ?>
</body>
</html>