-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComments.php
189 lines (184 loc) · 8.37 KB
/
Comments.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php require_once("Includes/DB.php"); ?>
<?php require_once("Includes/Functions.php"); ?>
<?php require_once("Includes/Sessions.php"); ?>
<?php
$_SESSION["TrackingURL"]=$_SERVER["PHP_SELF"];
Confirm_Login();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scal=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://kit.fontawesome.com/7f6ee3d237.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="css/main.css">
<title>Comments</title>
</head>
<body>
<!--NAVIGATION BAR STARTS-->
<div style="height: 10px; background: cornflowerblue"></div>
<div class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a href="#" class="navbar-brand">THINK HARD</a>
<button style="background-color: #BEC9F2;" class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarcollapse">
<span class="navbar-toggle-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarcollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a href="MyProfile.php" class="nav-link"><i class="fas fa-user text-success"></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">Manage Admins</a>
</li>
<li class="nav-item">
<a href="Comments.php" class="nav-link">Comments</a>
</li>
<li class="nav-item">
<a href="index.php?page=1" class="nav-link">GO Live</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a href="Logout.php" class="nav-link text-danger"><i class="fas fa-sign-out-alt"></i> Logout</a></li>
</ul>
</div>
</div>
</div>
<div style="height: 10px; background: cornflowerblue"></div>
<!--NAVIGATION BAR ENDS-->
<!--HEADER STARTS-->
<header class="bg-dark text-white py-3">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1><i class="fas fa-comments"></i> Manage Comments</h1>
</div>
</div>
</div>
</header>
<!--HEADER ENDS-->
<section class="container py-2 mb-4">
<div class="row" style="min-height: 30px;">
<div class="col-lg-12" style="min-height: 400px;">
<?php
echo ErrorMessage();
echo SuccessMessage();
?>
<h2>Un-Approved Comments</h2>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>No. </th>
<th>Date&Time</th>
<th>Name</th>
<th>Comment</th>
<th>Approve</th>
<th>Action</th>
<th>Details</th>
</tr>
</thead>
<?php
global $ConnectingDB;
$sql = "SELECT * FROM comments WHERE status='OFF' ORDER BY id desc";
$Execute = $ConnectingDB->query($sql);
$SrNo = 0;
while ($DataRows=$Execute->fetch()){
$CommentId = $DataRows["id"];
$DateTimeOfComment = $DataRows["datetime"];
$CommenterName = $DataRows["name"];
$CommentContent= $DataRows["comment"];
$CommentPostId = $DataRows["post_id"];
$SrNo++;
?>
<tbody>
<tr>
<td><?php echo htmlentities($SrNo); ?></td>
<td><?php echo htmlentities($DateTimeOfComment); ?></td>
<td><?php echo htmlentities($CommenterName); ?></td>
<td><?php echo htmlentities($CommentContent); ?></td>
<td><a href="ApproveComments.php?id=<?php echo $CommentId;?>" class="btn btn-success">Approve</a></td>
<td><a href="DeleteComments.php?id=<?php echo $CommentId;?>" class="btn btn-danger">Delete</a></td>
<td><a class="btn btn-primary" href="FullPost.php?id<?php echo $CommentPostId; ?>" target="_blank">Live preview</a></td>
</tr>
</tbody>
<?php }?>
</table>
</div>
<!-- approved comments-->
<h2>Approved Comments</h2>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>No. </th>
<th>Date&Time</th>
<th>Name</th>
<th>Comment</th>
<th>Revert</th>
<th>Action</th>
<th>Details</th>
</tr>
</thead>
<?php
global $ConnectingDB;
$sql = "SELECT * FROM comments WHERE status='ON' ORDER BY id desc";
$Execute = $ConnectingDB->query($sql);
$SrNo = 0;
while ($DataRows=$Execute->fetch()){
$CommentId = $DataRows["id"];
$DateTimeOfComment = $DataRows["datetime"];
$CommenterName = $DataRows["name"];
$CommentContent= $DataRows["comment"];
$CommentPostId = $DataRows["post_id"];
$SrNo++;
?>
<tbody>
<tr>
<td><?php echo htmlentities($SrNo); ?></td>
<td><?php echo htmlentities($DateTimeOfComment); ?></td>
<td><?php echo htmlentities($CommenterName); ?></td>
<td><?php echo htmlentities($CommentContent); ?></td>
<td style="min-width:140px;"><a href="DisApproveComments.php?id=<?php echo $CommentId;?>" class="btn btn-warning">Dis-Approve</a></td>
<td style="min-width:140px;"><a href="DeleteComments.php?id=<?php echo $CommentId;?>" class="btn btn-danger">Delete</a></td>
<td style="min-width:140px;"><a class="btn btn-primary" href="FullPost.php?id<?php echo $CommentPostId; ?>" target="_blank">Live preview</a></td>
</tr>
</tbody>
<?php }?>
</table>
</div>
</div>
</div>
</section>
<!--FOOTER STARTS-->
<div style="height: 5px; background: cornflowerblue"></div>
<footer class="bg-dark text-white">
<div class="container">
<div class="row">
<div class="col">
<p class="lead text-center">THINK HARD | <span id="year"></span>©: -----All right reserved</p>
</div>
</div>
</div>
</footer>
<div style="height: 5px; background: cornflowerblue"></div>
<!--FOOTER ENDS-->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<script>
$('#year').text(new Date().getFullYear());
</script>
</body>
</html>