-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.php
executable file
·49 lines (43 loc) · 1.17 KB
/
blog.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
<!DOCTYPE html>
<html>
<?php
$thisPost = null;
if (isset($_GET['post'])) {
$thisPost = $_GET['post'];
$thisPost = str_replace('-', ' ', $thisPost);
}
$title = "Blog";
if ($thisPost !== null) {
$title = $title . " - " . $thisPost;
}
include "bck/head.php";
?>
<body>
<div id="wrapper">
<?php include 'bck/header.php' ?>
<div id="content">
<div id="inner">
<?php
if ($thisPost === null) {
$db = new SQLite3('data.db');
$query = $db->query('SELECT * FROM Blog ORDER BY PostID DESC');
$post = $query->fetchArray();
while ($post) {
include "bck/blogpost.php";
$post = $query->fetchArray();
}
} else {
$db = new SQLite3('data.db');
$query = $db->query('SELECT * FROM Blog WHERE Name = "' . SQLite3::escapeString($thisPost) . '"');
$post = $query->fetchArray();
if ($post) include "bck/blogpost.php";
else { ?><meta http-equiv="refresh" content="0; blog" /><?php }
}
?>
<div class="blog-spacer"></div>
</div>
</div>
<?php include 'bck/footer.php'; ?>
</div>
</body>
</html>