AIPT/cms_admin/comments.php

100 lines
5.0 KiB
PHP
Raw Normal View History

2024-10-29 11:42:53 +08:00
<?php include('container/security.php');?>
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<!-- head links start -->
<?php include 'container/head_links.php';?>
<!-- head links start -->
</head>
<body>
<!-- side_bar start -->
<?php include 'container/side_bar.php' ?>
<!-- side_bar end -->
<main class="dashboard-main">
<!-- Header start -->
<?php include 'container/header.php' ?>
<div class="dashboard-main-body">
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3 mb-24">
<h6 class="fw-semibold mb-0">AI Tool Contact Data</h6>
</div>
<div class="card basic-data-table">
<div class="card-header">
<h5 class="card-title mb-0">All Contacts List</h5>
</div>
<div class="card-body">
<table class="table bordered-table mb-0" id="dataTable" data-page-length='10'>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Blog ID</th>
<th scope="col">User Info</th>
<th scope="col">Comment</th>
<th scope="col">Status</th>
<th scope="col">Submission Date</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<?php
// Fetch contact form data
$result = mysqli_query($conn, "
SELECT *
FROM comment
");
$i = 1;
while ($row = mysqli_fetch_assoc($result)) {
$c_id = $row['id'];
$blog = htmlspecialchars($row['b_id']);
$name = htmlspecialchars($row['name']);
$email = htmlspecialchars($row['email']);
$message = htmlspecialchars($row['message']);
$submission_date = htmlspecialchars($row['created_at']);
$status = htmlspecialchars($row['status']);
if ($status == 1) {
$status = '<b class="text-success">Active</b>';
} else {
$status = '<b class="text-danger">Blocked</b>';
}
echo "
<tr>
<td>$i</td>
<td>$blog</td>
<td>$name<br>$email</td>
<td><textarea readonly class='form-control' rows='3'>$message</textarea></td>
<td>$status</td>
<td>$submission_date</td>
<td>
<a href='comment_status?id=$c_id&status=1' class='w-32-px h-32-px bg-success-focus text-success-main rounded-circle d-inline-flex align-items-center justify-content-center' onclick='return confirm(\"Are you sure you want to active this comment?\");'>
<iconify-icon icon='mingcute:check-line'></iconify-icon>
</a>
<a href='comment_status?id=$c_id&status=0' class='w-32-px h-32-px bg-warning-focus text-warning-main rounded-circle d-inline-flex align-items-center justify-content-center' onclick='return confirm(\"Are you sure you want to block this comment?\");'>
<iconify-icon icon='ion:ban'></iconify-icon>
</a>
<a href='comment_delete?id=$c_id' class='w-32-px h-32-px bg-danger-focus text-danger-main rounded-circle d-inline-flex align-items-center justify-content-center' onclick='return confirm(\"Are you sure you want to delete this comment?\");'>
<iconify-icon icon='mingcute:delete-2-line'></iconify-icon>
</a>
</td>
</tr>";
$i++;
}
mysqli_close($conn);
?>
</tbody>
</table>
</div>
</div>
</div>
<?php include 'container/footer.php' ?>
</main>
<!-- Footer Links Start -->
<?php include 'container/footer_links.php' ?>
<script>
let table = new DataTable('#dataTable');
</script>
</body>
</html>