-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPosts.php
More file actions
343 lines (319 loc) · 11.7 KB
/
Copy pathPosts.php
File metadata and controls
343 lines (319 loc) · 11.7 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<?php require_once("Includes/DB.php"); ?>
<?php require_once("Includes/Functions.php"); ?>
<?php require_once("Includes/Sessions.php"); ?>
<?php
$_SESSION["TrackingURL"]=$_SERVER["PHP_SELF"];
//echo $_SESSION["TrackingURL"];
Confirm_Login();
$Admin = $_SESSION["UserName"];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="Css/Styles.css">
<link rel="stylesheet" href="Css/NavSelect.css">
<title>Posts</title>
</head>
<body>
<!-- NAVBAR -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-1">
<div class="container">
<a href="index.php?page=1" class="navbar-brand">CMSsite</a>
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarcollapseCMS">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarcollapseCMS">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a href="MyProfile.php" class="nav-link"> <i class="fas fa-user text-info"></i> My Profile</a>
</li>
<li class="nav-item">
<a href="Dashboard.php" class="nav-link">Dashboard</a>
</li>
<li class="nav-item">
<a href="Posts.php" class="nav-link">Posts</a>
</li>
<li class="nav-item">
<a href="Categories.php" class="nav-link">Categories</a>
</li>
<li class="nav-item">
<a href="Admins.php" class="nav-link">Admins</a>
</li>
<li class="nav-item">
<a href="Comments.php" class="nav-link">Comments</a>
</li>
<li class="nav-item">
<a href="Blog.php?page=1" class="nav-link" target="_blank">Live Blog</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a href="Logout.php" class="nav-link text-danger">
<i class="fa fa-sign-out" style="font-size:18px"></i> Logout</a></li>
</ul>
</div>
</div>
</nav>
<!-- NAVBAR END -->
<!-- HEADER -->
<header class="bg-dark text-white py-2">
<div class="container">
<div class="row">
<div class="col-md-12">
<h3><i class="fas fa-blog" style="color:#27aae1;"></i> Blog Posts</h3>
</div>
<div class="col-lg-3 mb-2">
<a href="AddNewPost.php" class="btn btn-info btn-block text-info bg-dark">
<i class="fas fa-edit"></i> Add New Post
</a>
</div>
<div class="col-lg-3 mb-2">
<a href="Categories.php" class="btn btn-info btn-block text-info bg-dark">
<i class="fas fa-folder-plus"></i> Add New Category
</a>
</div>
<div class="col-lg-3 mb-2">
<a href="Admins.php" class="btn btn-info btn-block text-info bg-dark">
<i class="fas fa-user-plus"></i> Admin Settings
</a>
</div>
<div class="col-lg-3 mb-2">
<a href="Comments.php" class="btn btn-info btn-block text-info bg-dark">
<i class="fas fa-check"></i> Approve Comments
</a>
</div>
</div>
</div>
</header>
<!-- HEADER END -->
<!-- Main Area -->
<section class="container py-2 mb-4">
<div class="row">
<div class="col-lg-12 ">
<?php
echo ErrorMessage();
echo SuccessMessage();
?>
<table class="table table-striped table-hover text-light table-responsive">
<thead class="thead-dark">
<tr>
<th>#</th>
<th>Title</th>
<th>Category</th>
<th>Date&Time</th>
<th>Author</th>
<th>Banner</th>
<th>Comments</th>
<th>Action</th>
<th>Live Preview</th>
</tr>
</thead>
<?php
global $ConnectingDB;
if(isset($_SESSION["UserName"])){
$Admin = $_SESSION["UserName"];
if($Admin=='attiqueurrehman12'){
$sql = "SELECT * FROM posts ORDER BY id desc";
$stmt = $ConnectingDB->query($sql);
$Sr = 0;
while ($DataRows = $stmt->fetch()) {
$Id = $DataRows["id"];
$DateTime = $DataRows["datetime"];
$PostTitle = $DataRows["title"];
$Category = $DataRows["category"];
$Admin = $DataRows["author"];
$Image = $DataRows["image"];
$PostText = $DataRows["post"];
$Sr++;
?>
<tbody>
<tr>
<td>
<?php echo $Sr; ?>
</td>
<td>
<?php
if(strlen($PostTitle)>20){$PostTitle= substr($PostTitle,0,18).'..';}
echo $PostTitle;
?>
</td>
<td>
<?php
if(strlen($Category)>8){$Category= substr($Category,0,8).'..';}
echo $Category ;
?>
</td>
<td>
<?php
if(strlen($DateTime)>11){$DateTime= substr($DateTime,0,11).'..';}
echo $DateTime ;
?>
</td>
<td>
<?php
if(strlen($Admin)>6){$Admin= substr($Admin,0,6).'..';}
echo $Admin ;
?>
</td>
<td><img src="Uploads/<?php echo $Image ; ?>" width="170px;" height="50px"</td>
<td>
<?php $Total = ApproveCommentsAccordingtoPost($Id);
if ($Total>0) {
?>
<span class="badge badge-success">
<?php
echo $Total; ?>
</span>
<?php } ?>
<?php $Total = DisApproveCommentsAccordingtoPost($Id);
if ($Total>0) {
?>
<span class="badge badge-danger">
<?php
echo $Total; ?>
</span>
<?php } ?>
</td>
<td>
<a href="EditPost.php?id=<?php echo $Id; ?>"class="btn btn-info text-info bg-dark"><span >Edit</span></a>
<a href="DeletePost.php?id=<?php echo $Id; ?>"class="btn btn-info text-info bg-dark"><span >Delete</span></a>
</td>
<td>
<a href="FullPost.php?id=<?php echo $Id; ?>&&author=<?php echo $Admin; ?>" class="btn btn-info text-info bg-dark" target="_blank"><span>Live Preview</span></a>
</td>
</tr>
</tbody>
<?php }}
else{
$sql = "SELECT * FROM posts WHERE author='$Admin' ORDER BY id desc";
$stmt = $ConnectingDB->query($sql);
$Sr = 0;
while ($DataRows = $stmt->fetch()) {
$Id = $DataRows["id"];
$DateTime = $DataRows["datetime"];
$PostTitle = $DataRows["title"];
$Category = $DataRows["category"];
$Admin = $DataRows["author"];
$Image = $DataRows["image"];
$PostText = $DataRows["post"];
$Sr++;
?>
<tbody>
<tr>
<td>
<?php echo $Sr; ?>
</td>
<td>
<?php
if(strlen($PostTitle)>20){$PostTitle= substr($PostTitle,0,18).'..';}
echo $PostTitle;
?>
</td>
<td>
<?php
if(strlen($Category)>8){$Category= substr($Category,0,8).'..';}
echo $Category ;
?>
</td>
<td>
<?php
if(strlen($DateTime)>11){$DateTime= substr($DateTime,0,11).'..';}
echo $DateTime ;
?>
</td>
<td>
<?php
if(strlen($Admin)>6){$Admin= substr($Admin,0,6).'..';}
echo $Admin ;
?>
</td>
<td><img src="Uploads/<?php echo $Image ; ?>" width="170px;" height="50px"</td>
<td>
<?php $Total = ApproveCommentsAccordingtoPost($Id);
if ($Total>0) {
?>
<span class="badge badge-success">
<?php
echo $Total; ?>
</span>
<?php } ?>
<?php $Total = DisApproveCommentsAccordingtoPost($Id);
if ($Total>0) {
?>
<span class="badge badge-danger">
<?php
echo $Total; ?>
</span>
<?php } ?>
</td>
<td>
<a href="EditPost.php?id=<?php echo $Id; ?>" class="btn btn-info text-info bg-dark"><span class="btn btn-warning">Edit</span></a>
<a href="DeletePost.php?id=<?php echo $Id; ?>" class="btn btn-info text-info bg-dark"><span >Delete</span></a>
</td>
<td>
<a href="FullPost.php?id=<?php echo $Id; ?>&&author=<?php echo $Admin; ?>" class="btn btn-info text-info bg-dark" target="_blank"><span>Live Preview</span></a>
</td>
</tr>
</tbody>
<?php }
}
} ?> <!-- Ending of While loop -->
</table>
</div>
</div>
</section>
<!-- Main Area End -->
<!-- FOOTER -->
<footer class="footer-distributed bg-dark text-white ">
<div class="footer-left">
<h3>CMS<span>site</span></h3>
<p class="footer-links">
<a href="#">Home</a>
·
<a href="#">Blog</a>
·
<a href="#">Pricing</a>
·
<a href="#">About</a>
·
<a href="#">Faq</a>
·
<a href="#">Contact</a>
</p>
<p id="aboutUs" class="">About Us </p>
<p style="margin-top:-12px;" class="small text-info lead">CMSsite is a blog where you can learn</p>
<p class="lead">Copyright © <span id="year"></span> All Rights Reserved.</p>
<div class="footer-icons">
<a href="https://www.facebook.com/malikattique2"><i class="fa fa-facebook-square"></i></a>
<a href="https://www.instagram.com/malikkattik/"><i class="fa fa-instagram"></i></a>
<a href="https://www.linkedin.com/in/attiqueurrehman12/"><i class="fa fa-linkedin"></i></a>
<a href="https://github.com/malikattique1/"><i class="fa fa-github"></i></a>
</div>
</div>
<div class="footer-right">
<?php
echo ContactusPlaceMessage();
?>
<p>Contact Us</p>
<form action="Blog.php" method="post" id="contactusform">
<input type="email" name="email" placeholder="Email">
<textarea type="text" name="message" placeholder="Message"></textarea>
<button class="btn btn-sm btn-info text-light bg-info" type="submit" name="ContactUsSubmit">Send</button>
</form>
</div>
</footer>
<!-- FOOTER END-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script>
$('#year').text(new Date().getFullYear());
</script>
<script type="text/javascript" src="js/NavSelect.js"></script>
</body>
</html>