-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow-post.php
65 lines (56 loc) · 1.74 KB
/
show-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
62
63
64
65
<?php
session_start();
include "include/function.php";
include "include/db.php";
if(!isset($_GET['id']))
redirect(absolute);
$query = "
SELECT `title`, `memo`, `image`, `category_id`, `category`.`name` AS 'category_name' , `keyword`, `description`
FROM `post` LEFT JOIN `category` ON `post`.`category_id` = `category`.`id` WHERE `post`.`id` = {$_GET['id']}
";
$select = mysqli_query($con, $query);
$post = mysqli_fetch_assoc($select);
if($post == null || count($post) <= 0)
exit("پست وجود ندارد");
mysqli_query($con, "UPDATE `post` SET `view` = `view` + 1 WHERE `id` = {$_GET['id']}");
?>
<!DOCTYPE html>
<html>
<?php
$extra = '
<link rel="stylesheet" href="css/show-post.css">
<meta name="description" content="'.$post['description'].'">
<meta name="keywords" content="'.$post['keyword'].'">
';
head($post['title'], "index", $extra);
?>
<body>
<?php
include "include/header.php";
?>
<main>
<img src="<?php echo url_post_image($post['image']) ?>" alt="<?php echo $post['title'] ?>">
<h1><?php echo $post['title'] ?></h1>
<span>دسته بندی: <a href="<?php echo url_category($post['category_id']) ?>"><?php echo $post['category_name'] ?></a></span>
<p><?php echo $post['memo'] ?></p>
<div class="suggestion">
<div class="item">
<img src="upload/post/113646991150.jpg" alt="">
<h1>لورم الیپسوم</h1>
</div>
<div class="item">
<img src="upload/post/113646991150.jpg" alt="">
<h1>لورم الیپسوم</h1>
</div>
<div class="item">
<img src="upload/post/113646991150.jpg" alt="">
<h1>لورم الیپسوم</h1>
</div>
</div>
</main>
<?php
include "include/aside.php";
include "include/footer.php";
?>
</body>
</html>