-
Notifications
You must be signed in to change notification settings - Fork 0
/
posts.php
126 lines (104 loc) · 3.27 KB
/
posts.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/*
================================================
== Profile Page
== You Can Edit your Profile From Here
================================================
*/
ob_start(); // Output Buffering Start
session_start();
global $session_user;
$pageTitle = 'Posts';
// get init app core
include 'init.php';
// get header
$hook_up->inc_header();
// Check If Get Request userid Is Numeric & Get Its Integer Value
$postid = isset($_GET['postid']) && is_numeric($_GET['postid']) ? intval($_GET['postid']) : 0;
// Select All Data Depend On This ID
$stmt = $con->prepare("SELECT posts.*, users.Username, categories.Name AS cat_name
FROM posts
INNER JOIN users
ON posts.Member_ID = users.UserID
INNER JOIN categories
ON posts.Cat_ID = categories.ID
WHERE Post_ID = ?");
// Execute Query
$stmt->execute(array($postid));
// Fetch The Data
$posts = $stmt->fetch();
// The Row Count
$count = $stmt->rowCount();
// If There's Such ID Show The Form
if ($count > 0) {
if(isset($session_user)) {
?>
<main class="container">
<div class="text-center row">
<div class="col-sm-12 col-md-9">
<h1 class="post_title">
<?php echo $posts['Name']; ?>
</h1>
<!-- <img class="post_img" src="admin/uploads/posts/<?php // echo $posts['Image']; ?>" alt=""> -->
<div class="img-responsive img-thumbnail post_img" style="background-image: url('admin/uploads/posts/<?php echo $posts['Image']; ?>');">
</div>
<div class="">
<p class="post-content text-center">
<?php echo $posts['Description']; ?>
</p>
</div>
<div class="row">
<div class="col-sm-12 col-md-6">
<p class="post_info">
<?php
if ($posts['Status'] == 1) {
echo "نشر";
} else{
echo "أرشيف";
} ?> -
<span>
<?php echo date("M Y", strtotime($posts['Add_Date']));?>
</span> -
فى
<span>
<?php echo $posts['cat_name']; ?>
</span> بواسطة
<span>
<?php echo $posts['Username']; ?>
</span>
</p>
</div>
<div class="col-sm-12 col-md-6">
<p class="post_rating">
<?php echo 'تقييم : <span>' . $posts['Rating'] . ' <i class="fas fa-star" ></i></span>'; ?>
</p>
</div>
</div>
<div class="col-sm-12 col-md-12 tags">
<?php
$post_tags = explode(',', $posts['tags']);
echo 'كلمات مميزة : ';
foreach ($post_tags as $tag) {
$tag = str_replace(' ', '', $tag);
$tag = strtolower($tag);
echo '<a href="tags.php?tags='.$tag.'">' . $tag .'</a>' . ' - ';
}
?>
</div>
</div>
<div class="col-sm-12 col-md-3">
<?php include $templates . 'sidebar-post.php'; ?>
</div>
</div>
<?php include $templates . 'comments/comments.php' ?>
</main>
<!-- End Comments Section -->
<?php
$hook_up->inc_footer('main', '-');
}
} else {
echo '<div class="container">
<div class="nice-message">There\'s No Posts To Show</div>
</div>';
}
ob_end_flush(); // Release The Output ?>