Server : LiteSpeed System : Linux in-mum-web983.main-hosting.eu 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : u520472703 ( 520472703) PHP Version : 8.2.29 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail Directory : /home/u520472703/domains/gadhiaassociate.com/public_html/admin/ |
<?php
include "components/header.php";
?>
<script>
function submitCheckbox(id, flag, home) {
console.debug("file: blogs.php:6 ~ submitCheckbox ~ home:", home);
console.debug("file: blogs.php:6 ~ submitCheckbox ~ flag:", flag);
const value = flag == 'home' ? (home == 1 ? 0 : 1) : home;
const url = 'includes/ajax/homecheck.php?id=' + id + '&value=' + value + '&type=gallery';
$.ajax({
url,
success: (log) => {
// console.debug(log)
console.debug("done");
}
})
}
</script>
<?php
if (isset($_POST['delete'])) {
$checkbox = $_POST['check'];
$n = 0;
for ($i = 0; $i < count($checkbox); $i++) {
$del_id = $checkbox[$i];
$msg = $checkbox[$i] . "Data deleted successfully !";
$sql = "DELETE FROM gallery WHERE id =" . $del_id;
mysqli_query($conn, $sql);
$n++;
// $msg = "Data deleted successfully !";
}
$msg = $n . " Items deleted successfully !";
// mysqli_query($conn,"DELETE FROM employee WHERE userid='".$del_id."'");
}
?>
<a class="btn btn-primary p-4 my-3 rounded-4" href="edit-blogs.php?act=add"> <i class="glyphicon glyphicon-plus-sign"></i> Add New Blog</a>
<h1>Blogs</h1>
<p>This table includes
<?php echo counting("gallery", "id"); ?> blogs.
</p>
<form method="post" action="">
<table id="sorted" class="table table-striped table-bordered">
<thead>
<tr>
<th colspan="2">
<button type="submit" onclick="return confirm('Are you sure you want to proceed?');" class="btn btn-danger btn-sm me-2" name="delete">DELETE SELECTED</button>
<button type="button" onclick="toggleSelection()" class="btn btn-primary btn-sm" name="selectall">SELECT ALL</button>
</th>
</tr>
<tr>
<th>Id</th>
<th>Title</th>
<th>Imgs</th>
<th>Category</th>
<th class="not text-nowrap">Show at Home</th>
<th class="not">Edit</th>
<th class="not">Delete</th>
<th>Select</th>
</tr>
</thead>
<?php
$gallery = getAll("gallery");
if ($gallery)
foreach ($gallery as $gallerys):
?>
<tr>
<td>
<?php echo $gallerys['id'] ?>
</td>
<td>
<?php echo $gallerys['title'] ?>
</td>
<td style="text-align: center;">
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<?php
foreach (explode(",", $gallerys['imgSrc']) as $img) {
echo '<div class="swiper-slide">';
echo '<img class="me-2" alt="Corrupted Image" src="../assets/img/' . $img . '" ; /></div>';
}
?>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-pagination"></div>
</div>
</td>
<td>
<?php
if(isset($gallerys['c_id'])){
$category = getBycId("category", $gallerys['c_id']);
echo $category['name'];
} else {
echo "<b title='Category Deleted. Click to See the Important Message' style='cursor:pointer' onclick='noCatFound()' class='text-danger'><i>Not Found - <a class='badge rounded-pill bg-danger'><i class='fa fa-question' aria-hidden='true'></i></a></i></b>";
}
?>
</td>
<td >
<div class="form-check form-switch " style="height:auto;overflow:auto;">
<input <?php if($gallerys['c_id']==NULL){ echo "disabled"; } ?> style="height:30px;width:50px;cursor:pointer" type='checkbox' class="form-check-input me-1" type="checkbox" role="switch" id='isHome'
onchange="submitCheckbox('<?= $gallerys['id'] ?>', 'home', '<?= $gallerys['isHome'] ?>')"
name='ishome' <?php if ($gallerys['isHome'] == 1) {
echo "checked";
} ?>>
</div>
</td>
<td><a href="edit-blogs.php?act=edit&id=<?php echo $gallerys['id'] ?>"><i
class="glyphicon glyphicon-edit"></i></a></td>
<td><a href="save.php?act=delete&id=<?php echo $gallerys['id'] ?>&cat=blog"
onclick="return navConfirm(this.href);"><i class="glyphicon glyphicon-trash"></i></a></td>
<td style="text-align: center">
<input style="height: 18px; width: 18px; text-align: center;" type='checkbox' id='checkItem' name='check[]'
value='<?php echo $gallerys['id'] ?>'>
</td>
<!-- </td> -->
</tr>
<?php endforeach; ?>
</table>
</form>
<?php include "components/footer.php"; ?>
<script type="text/javascript">
$("#checkAl").click(function () {
$('input:checkbox').not(this).prop('checked', this.checked);
});
function noCatFound(){
alert("In this blog, there currently isn't any assigned category. Due to the absence of a category, this blog remains hidden from all users. To make it accessible, kindly consider adding a new category.");
}
</script>