-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathposts.php
168 lines (146 loc) · 4.54 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
/*
================================================
== Profile Page
== You Can Edit your Profile From Here
================================================
*/
ob_start(); // Output Buffering Start
session_start();
global $session_user;
$pageTitle = 'الأقسام';
// 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, users.avatar, 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">
<h4 class="post_title">
<?php echo $posts['Name']; ?>
</h4>
</div>
<div class="col-sm-12 col-md-4">
<img class="img-responsive img-thumbnail post_img" src="admin/uploads/posts/<?php echo $posts['Image']; ?>" alt="">
</div>
<div class="col-sm-12 col-md-8">
<div class="row">
<div class="col-sm-9">
<p class="post-content text-center">
<?php echo $posts['Description']; ?>
</p>
</div>
<div class="col-sm-3">
<p class="post_rating">
<?php echo $posts['Price'] . ' <i class="fas fa-dollar-sign" ></i>'; ?>
</p>
</div>
<div class="col-sm-12">
<p class="post_rating">
<?php echo 'تقييم : <span>' . $posts['Rating'] . ' <i class="fas fa-star" ></i></span>'; ?>
</p>
</div>
</div>
</div>
<div class="col-sm-12">
<ul class="nav nav-tabs">
<li class="active_tab"><a href="#tab-1">وصف المنتج</a></li>
<li class=""><a href="#tab-2">السعر</a></li>
<li class=""><a href="#tab-3">التقييم</a></li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane active_tab">
<p class="post-content text-center">
<?php echo $posts['Description']; ?>
</p>
</div>
<div id="tab-2" class="tab-pane">
<div class="col-sm-12">
<p class="post_rating">
<?php echo 'السعر : <span>' . $posts['Price'] . ' <i class="fas fa-dollar-sign" ></i></span>'; ?>
</p>
</div>
</div>
<div id="tab-3" class="tab-pane">
<div class="col-sm-12">
<p class="post_rating">
<?php echo 'تقييم : <span>' . $posts['Rating'] . ' <i class="fas fa-star" ></i></span>'; ?>
</p>
</div>
</div>
</div>
</div>
<!-- author box -->
<div class="col-sm-12">
<div class="row post_hold_info">
<div class="col-md-6 post_info">
<img width="70" src="admin/uploads/avatars/<?php echo $posts['avatar']; ?>" alt="">
<h3>
<a class="user_av">
<?php echo $posts['Username']; ?>
</a>
</h3>
</div>
<div class="col-md-6">
<p class="post_info">
<?php echo $posts['Status'] == 1 ? "تم نشره فى" : ""; ?>
<span><?php echo date("M Y", strtotime($posts['Add_Date']));?></span>
</p>
<p class="post_info">
<?php echo $posts['cat_name']; ?>
</p>
</div>
</div>
</div>
<div class="col-sm-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="row">
<?php
// arr to store homepage sections title
$homepage_sec = array('random_posts');
// loop through homepage sections
foreach ($homepage_sec as $sec) { include($hook_up->component($sec, true)); }
?>
</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 ?>