-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomerBlogCreate.php
More file actions
104 lines (99 loc) · 3.54 KB
/
Copy pathcustomerBlogCreate.php
File metadata and controls
104 lines (99 loc) · 3.54 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
session_start();
/** @var mysqli $db */
require_once "includes/database.php";
if (!empty($_SESSION)) {
$sessionId = $_SESSION['id'];
$login = true;
//gets the users data from the database
$query = "SELECT * FROM users WHERE id = '$sessionId'";
$result = mysqli_query($db, $query);
//puts the data in an array
$user = mysqli_fetch_assoc($result);
} else {
$login = false;
}
if (isset($_POST['submit'])) {
$title = $_POST['title'];
$text = $_POST['text'];
$recap = $_POST['recap'];
$image = $_POST['image'];
$userId = $user['id'];
$query = "INSERT INTO customerblogposts (user_id, title, text, recap, picture_link) VALUES ('$userId', '$title', '$text', '$recap', '$image')";
mysqli_query($db, $query);
header('Location: customerBlogOverview.php');
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/global.css">
<link rel="stylesheet" href="css/register.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Almarai&family=Annie+Use+Your+Telescope&display=swap">
<title>Klant Create Blog</title>
</head>
<body>
<nav>
<div class="navbar-middle">
<img src="images/Logo-reserveringsysteem.png" alt="wolhoop-logo">
<a href="index.php">Home</a>
<a href="blogOverview.php">Blog</a>
<a href="customerBlogOverview.php" class="location">Klant Blog</a>
<a href="kleuren.php">Kleuren</a>
<?php if ($user['isAdmin']) {?>
<a href="orders.php">Bestellingen</a>
<?php } else {?>
<a href="bestellen.php">Bestellen</a>
<?php } ?>
<a href="contact.php">Over Wolhoop</a>
</div>
<div class="login">
<?php if ($login) { ?>
<a href="profile.php">Profiel</a>
<?php } else { ?>
<a href="login.php">Login</a>
<?php } ?>
</div>
</nav>
<main>
<img src="images/wool.png" alt="landschap">
<div class="form">
<form action="" method="post">
<h2 class="title">Nieuwe Blog</h2>
<div class="stack">
<label for="title">Titel</label>
<input type="text" id="title" name="title">
</div>
<div class="stack">
<label for="recap">Samenvatting</label>
<input type="text" id="recap" name="recap">
</div>
<div class="stack">
<label for="text">Tekst</label>
<textarea id="text" name="text" placeholder="Schrijf hier je tekst..."></textarea>
</div>
<div class="stack">
<label for="image">Link naar foto</label>
<input type="text" id="image" name="image">
</div>
<input type="submit" id="submit" name="submit" class="blogsubmit">
</form>
<a href="customerBlogOverview.php">Annuleren</a>
</div>
<img src="images/wool.png" alt="landschap">
</main>
<footer>
<img src="images/Logo-reserveringsysteem.png" alt="wolhoop-logo">
<div>
<img src="images/instagram.png" alt="instagram-logo">
<a href="https://www.instagram.com/dewolhoopspinning/">@dewolhoopspinning</a>
<img src="images/facebook.png" alt="facebook-logo">
<a href="https://www.facebook.com/groups/3217490328265360">De Wolhoop</a>
</div>
</footer>
</body>
</html>