-
Notifications
You must be signed in to change notification settings - Fork 0
/
form_handle.php
60 lines (41 loc) · 1.23 KB
/
form_handle.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Home</title>
<link rel="stylesheet" href="CSS/stylesheet.css">
</head>
<body>
<?php
echo "<hr>";
if (isset($_SESSION["email"])){
echo '<nav id="navbar">
<a href="login.php" id="" class="navlink">Login</a>
<a href="register.php" id="" class="navlink">Register</a>
</nav>';
} else{
echo '<nav id="navbar">
<a href="home.php" id="" class="navlink">Home</a>
<a href="form.php" id="" class="navlink">Add a book</a>
<a href="logout.php" id="" class="navlink">Logout</a>
</nav>';
}
?>
<?php
session_start();
if (isset($_SESSION["email"])){
}else{
header('Location: home.php');
}
include 'database.php';
$book_title = $_POST['book_title'];
$book_description = $_POST['book_description'];
$img = $_POST['img'];
$book = new Database("localhost");
$book->conn();
$book->insertIntoQuery($book_title, $book_description, $img);
?>
</body>
</html>