forked from jmsandiegoo/capstone-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
73 lines (66 loc) · 2.8 KB
/
index.php
File metadata and controls
73 lines (66 loc) · 2.8 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
<?php
session_start();
include_once __DIR__.'/helpers/helper.php';
$helper = new Helper();
if (isset($_SESSION['loggedin'])) {
$pageUrl = $helper->pageUrl('appointment.php');
header("Location: $pageUrl");
exit;
}
$login_error = "";
$success_reset = "";
$email = "";
$password = "";
if (isset($_GET["error"])) {
if ($_GET["error"] == "empty") {
$login_error = "Please fill both <b> email and password </b> fields.";
} else if ($_GET["error"] == "incorrect") {
$login_error = " Sorry, it seems that the <b> email and/or password is incorrect </b>. Please try again.";
}
}
if (isset($_GET["pwdupdate"])) {
if ($_GET["pwdupdate"] == "success") {
$success_reset = "Your password has been reset successfully!";
}
}
if (isset($_SESSION["email"]) && isset($_SESSION["password"])) {
$email = $_SESSION["email"];
$password = $_SESSION["password"];
}
unset($_SESSION["email"]);
unset($_SESSION["password"]);
?>
<!DOCTYPE html>
<html lang="en">
<?php include $helper->subviewPath('header.php') ?>
<main class="login-container">
<div class="login">
<h1>Login</h1>
<form action="process/loginFunctions.php" method="POST">
<div class="form-group">
<label for="emailAddressField"><i class="fas fa-envelope"></i></label>
<input type="email" class="text-field" id="emailAddressField" placeholder="Email Address" name="email" value="<?php echo $email ?>" >
</div>
<div class="form-group">
<label for="passwordField"><i class="fas fa-key"></i></label>
<input type="password" class="text-field" id="passwordField" placeholder="Password" name="password" value="<?php echo $password ?>" >
</div>
<input type="hidden" name="authenticate" value="true">
<?php if($login_error): ?>
<div id="loginErrorMessage" class="alert alert-danger" role="alert">
<?php echo $login_error ?>
</div>
<?php endif; ?>
<?php if($success_reset): ?>
<div id="loginSuccessResetMessage" class="alert alert-success" role="alert">
<?php echo $success_reset ?>
</div>
<?php endif; ?>
<button class="btn btn-login" type="submit">Log In</button>
</form>
<small><a href="<?php echo $helper->pageUrl("forgotPassword.php")?>" id="forgotPassword"><u>Forgot Password</u></a></small>
</div>
<!-- img logo here -->
</main>
<?php include $helper->subviewPath('footer.php') ?>
</html>