2022-12-30 03:25:40 +00:00
|
|
|
<?php
|
2023-03-07 01:23:47 +00:00
|
|
|
include 'partials/header.php';
|
|
|
|
|
|
|
|
//fetch 9post
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($_GET['id'])){
|
|
|
|
$id=filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT);
|
|
|
|
$query="SELECT * FROM posts WHERE id=$id";
|
|
|
|
$result=mysqli_query($connection,$query);
|
|
|
|
$post=mysqli_fetch_assoc($result);
|
|
|
|
$author_id=$post['author_id'];
|
|
|
|
$author_query="SELECT * FROM users WHERE id=$author_id";
|
|
|
|
$author_result=mysqli_query($connection,$author_query);
|
|
|
|
$author=mysqli_fetch_assoc($author_result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
header('location: ' . ROOT_URL . 'blog.php');
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
2022-12-30 03:25:40 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section class="singlepost">
|
|
|
|
<div class="container singlepost__container">
|
|
|
|
|
2023-03-07 01:23:47 +00:00
|
|
|
|
|
|
|
<h2>
|
|
|
|
<?=$post['title']?>
|
|
|
|
</h2>
|
2022-12-30 03:25:40 +00:00
|
|
|
<div class="post__author">
|
|
|
|
<div class="post__author-avatar">
|
2023-03-07 01:23:47 +00:00
|
|
|
<img src="./images/<?= $author['avatar'] ?>"> </div>
|
2022-12-30 03:25:40 +00:00
|
|
|
<div class="post__author-info">
|
2023-03-07 01:23:47 +00:00
|
|
|
<h5>By: <?= "{$author['firstname']} {$author['lastname']}" ?></h5>
|
|
|
|
<small>
|
|
|
|
<?=date("M d, Y -H:i" , strtotime($post['date_time']))?>
|
|
|
|
</small>
|
2022-12-30 03:25:40 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="singlepost__thumbnail">
|
2023-03-07 01:23:47 +00:00
|
|
|
<img src="./images/<?=$post['thumbnail']?>" >
|
2022-12-30 03:25:40 +00:00
|
|
|
</div>
|
2023-03-07 01:23:47 +00:00
|
|
|
<p><?=$post['body']?></p>
|
2022-12-30 03:25:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
include './partials/footer.php';
|
|
|
|
?>
|