-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.php
61 lines (43 loc) · 1.32 KB
/
post.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
<?php
include("config.php");
include("functions.php");
if(!loggedIn()){
header("Location: index.php?warning=You do not have permission to access the \"post.php\" page.");
}
$userInfo = json_decode(base64_decode($_COOKIE['login-session']));
$profileInformation = get_profile_information($userInfo->user_id);
if($profileInformation == "Error 404"){
header("Location: errors/404.php");
exit();
}
$pageTitle = "My Account - Vulnerable web application - arctil";
include("template/header.php");
echo '<h2>Post News</h2>';
?>
<section id="page-section">
<div id="news-preview-top"></div>
<div id="news-preview">
<form action="" method="POST">
<div id="form-input-section">
<label>Article Name: </label><br /><input type="text" name="name" />
</div>
<div id="form-input-section">
<label>Article Body</label><br />
<textarea name="body"></textarea>
</div>
<input type="hidden" name="user_id" value="<?php echo $userInfo->user_id; ?>" />
<div id="form-input-section">
<button class="button" name="post">Post News Article</button>
</div>
</form>
<?php
if(isset($_POST['post'])){
submit_news($_POST['user_id'], $_POST['name'], $_POST['body']);
}
?>
</div>
<div id="news-preview-bottom"></div>
</section>
<?php
include("template/footer.php");
?>