-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
34 lines (32 loc) · 1016 Bytes
/
edit.php
File metadata and controls
34 lines (32 loc) · 1016 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
33
34
<?php
include_once "includes/post.inc.php";
include_once "header.php";
?>
<?php //The user can only access this page if he is logged in AND is the author of the post
if (isset($_SESSION['uid'])) {
foreach ($query as $q) {
if ($_SESSION['uid'] == $q['author']) {
?>
<div class="form">
<form method="GET">
<input type="text" hidden name="id" value="<?php echo $q['id'];?>">
<input type="text" name="title" placeholder="Blog Title"
value="<?php echo $q['title'];?>">
<textarea name="content"><?php echo nl2br($q['content']);?></textarea>
<button name="update" class="btn edit">Update</button>
</form>
</div>
<?php
} else {
header("Location: index.php");
exit();
}
}
} else {
header("Location: index.php");
exit();
}
?>
<?php
include_once "footer.php";
?>