-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-author.php
97 lines (89 loc) · 3.14 KB
/
add-author.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
<?php
session_start();
# If the admin is logged in
if (isset($_SESSION['user_id']) &&
isset($_SESSION['user_email'])) {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Author</title>
<!-- bootstrap 5 CDN-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<!-- bootstrap 5 Js bundle CDN-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="admin.php">Admin</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse"
id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link"
aria-current="page"
href="index.php">Store</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="add-book.php">Add Book</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="add-category.php">Add Category</a>
</li>
<li class="nav-item">
<a class="nav-link active"
href="add-author.php">Add Author</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="logout.php">Logout</a>
</li>
</ul>
</div>
</div>
</nav>
<form action="php/add-author.php"
method="post"
class="shadow p-4 rounded mt-5"
style="width: 90%; max-width: 50rem;">
<h1 class="text-center pb-5 display-4 fs-3">
Add New Author
</h1>
<?php if (isset($_GET['error'])) { ?>
<div class="alert alert-danger" role="alert">
<?=htmlspecialchars($_GET['error']); ?>
</div>
<?php } ?>
<?php if (isset($_GET['success'])) { ?>
<div class="alert alert-success" role="alert">
<?=htmlspecialchars($_GET['success']); ?>
</div>
<?php } ?>
<div class="mb-3">
<label class="form-label">
Author Name
</label>
<input type="text"
class="form-control"
name="author_name">
</div>
<button type="submit"
class="btn btn-primary">
Add Author</button>
</form>
</div>
</body>
</html>
<?php }else{
header("Location: login.php");
exit;
} ?>