-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewpost.php
51 lines (42 loc) · 1.08 KB
/
viewpost.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
<?php
/**
* Project: blog
* File: viewpost.php
* User: commanderk33n
* Date: 10.10.15
* Time: 21:50
*/
require('includes/config.php');
$stmt = $db->prepare('SELECT postID, postTitle, postCont, postDate FROM blog_posts WHERE postID = :postID');
$stmt->execute(array(':postID' => $_GET['id']));
$row = $stmt->fetch();
//if post does not exists redirect user.
if ($row['postID'] == '') {
header('Location: ./');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>eikood.xyz<?php echo $row['postTitle'] ?></title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div id="wrapper">
<h1>My scrapbook and other silly crap...</h1>
<hr/>
<p><a href="./">back</a></p>
<div>
<h1><?= $row['postTitle'] ?></h1>
<p>Posted on <?= date('jS M Y', strtotime($row['postDate'])) ?> </p>
<p><?= $row['postCont'] ?></p>
</div>
</div>
<footer class="footer">
<p>© commanderk33n 2019 - proudly made without any framework</p>
</footer>
</body>
</html>