-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
86 lines (74 loc) · 3.35 KB
/
index.php
File metadata and controls
86 lines (74 loc) · 3.35 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
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
include_once("config/config.php");
include_once(DIR_URL . "config/database.php");
include_once(DIR_URL . "models/auth.php");
// If already logged in
if (isset($_SESSION['is_user_login'])) {
header("LOCATION: " . BASE_URL . 'dashboard.php');
exit;
}
// Login Functionality (pizza123)
if (isset($_POST['submit'])) {
$res = login($conn, $_POST);
if ($res['status'] == true) {
$_SESSION['is_user_login'] = true;
$_SESSION['user'] = $res['user'];
header("LOCATION: " . BASE_URL . 'dashboard.php');
exit;
} else {
$_SESSION['error'] = "Invalid login information";
header("LOCATION: " . BASE_URL);
exit;
}
}
?>
<!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 href="./assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="./assets/css/style.css" />
<script src="./assets/js/1c26fb5c51.js" crossorigin="anonymous"></script>
<title>Login | Star Library</title>
</head>
<body style="background-color: #212529">
<div class="container d-flex align-items-center justify-content-center vh-100">
<div class="row">
<div class="col-md-12 login-form">
<div class="card mb-3" style="max-width: 900px">
<div class="row g-0">
<div class="col-md-5">
<img src="./assets/images/login-bg.jpg" class="img-fluid rounded-start" />
</div>
<div class="col-md-7">
<div class="card-body">
<h1 class="card-title text-uppercase fw-bold">
BooKart
</h1>
<p class="card-text">Enter email and password to login</p>
<?php include_once(DIR_URL . "include/alerts.php"); ?>
<form method="post" action="<?php echo BASE_URL ?>">
<div class="mb-3">
<label class="form-label">Email address</label>
<input type="email" class="form-control" name="email" required />
</div>
<div class="mb-3">
<label class="form-label">Password</label>
<input type="password" class="form-control" name="password" required />
</div>
<button type="submit" name="submit" class="btn btn-primary">Login</button>
</form>
<hr />
<a href="./forgot-password.php" class="card-text text-center link-underline-light">Forgot Password?</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="./assets/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
</body>
</html>