-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-gwc.php
44 lines (39 loc) · 1.26 KB
/
post-gwc.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
<?php
session_start();
if (!isset($_SESSION["user"]) || empty($_SESSION["user"]["officer"])) {
die("Sorry, you do not have permission to view this page.");
}
if (isset($_POST['title']) && isset($_POST['day']) && isset($_POST['content'])) {
list($_POST['year'], $_POST['month'], $_POST['date']) = preg_split('[/.-]', $_POST['day']);
unset($_POST['day']);
$news_data = file_get_contents('content/gwc.json');
$news = json_decode($news_data, true);
array_unshift($news, $_POST);
$news_f = fopen("content/gwc.json","r+");
fwrite($news_f, json_encode($news, JSON_PRETTY_PRINT));
fclose($news_f);
header("Location: /gwc");
}
$pagetitle = 'Post GWC';
$pagedescription = "Yeah, now there's a gui for it";
include('includes/header.php');
?>
<div class="box-gray one-half">
<form method="post">
<p>
<label for="title">Title</label><br>
<input type="text" name="title">
</p>
<p>
<label for="day">Date</label><br>
<input type="date" name="day" placeholder="DD/MM/YYYY">
</p>
<p>
<label for="content">Content</label><br>
<textarea name="content"></textarea>
</p>
<!-- ohlook tis a center tag -->
<center><input type="submit" class="btn" value="Post"></center>
</form>
</div>
<?php include('includes/footer.php'); ?>