-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.php
More file actions
32 lines (31 loc) · 940 Bytes
/
create.php
File metadata and controls
32 lines (31 loc) · 940 Bytes
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
<?php
include_once "header.php";
?>
<?php
if (isset($_SESSION["uid"])) {
?>
<div class="form">
<form action="includes/create.inc.php" method="POST" enctype="multipart/form-data">
<input type="text" name="title" placeholder="Blog Title">
<input type="file" name="image">
<textarea name="content" placeholder="Your text here..."></textarea>
<input type="hidden" name="author" value="<?php echo $_SESSION['uid']?>">
<button type="submit" name="new_post" class="btn">Add Post</button>
</form>
<?php
if (isset($_GET["error"])) {
if ($_GET["error"] == "emptyinput") {
echo "<p class='error'>Fill in all fields!</p>";
}
}
?>
</div>
<?php
} else {
header("Location: index.php");
exit();
}
?>
<?php
include_once "footer.php";
?>