File: /home/u590867752/domains/artnculture.org/public_html/admin/view-blogs.php
<?php
include('blog-conn.php');
if (isset($_GET['status']) && $_GET['id']) {
$active=$_GET['status'];
$status_id=$_GET['id'];
$status_update = "UPDATE blog SET status='$active' WHERE id=$status_id";
if (mysqli_query($conn,$status_update)) {
}
}
if(!$_SESSION['adminName'] && !$_SESSION['adminPassword'] && !$_SESSION['campus'])
{
header('location:index.php');
}
if($_SESSION['campus'] != "Admin" )
{
header('location:index.php');
}
error_reporting(0);
if (isset($_GET['delete'])) {
$id=$_GET['delete'];
$delete="delete from blog where id='$id'";
if (mysqli_query($conn,$delete)) {
$msg = "delete successfuly";
header('location:view-blogs.php?Successfuly');
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="../images/logo-hai-clbrtn.png" type="image/x-icon" >
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../codes/css/home.css" media="screen" rel="stylesheet" type="text/css" />
<!--<link href="../codes/css/inside.css" media="screen" rel="stylesheet" type="text/css" />-->
<link rel="stylesheet" type="text/css" href="../codes/css/menu.css" media="all" />
<script src="https://www.himanshuartinstitute.com/codes/glry/js/jquery.min.js"></script>
<!-- Menu -->
<script src="https://www.himanshuartinstitute.com/admin/css/mnu/menu.js" ></script>
<script src="https://www.himanshuartinstitute.com/admin/css/mnu/jquery.js" ></script>
<link href="https://www.himanshuartinstitute.com/admin/css/mnu/css-menu.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<style type="text/css">
.border{border: 1ps solid;
padding: 10px}
.btn-sm a {color: #fff;
text-decoration: none;}
</style>
</head>
<body>
<header>
<div class="hdr-admin">
<div class="adm-lft">
<div class="hai"><a href="index.html"><span>Himanshu</span><span>Art</span><span>Institute</span></a></div>
</div>
<div class="adm-rgt">
<div id="menuiconb"><i class="fa fa-th" aria-hidden="true"></i></div>
</div>
</div>
</header>
<div class="clearfix"></div>
<h2 class="adm-title">View Blogs</h2>
<div class="container mt-5">
<div class="mt-5 mb-2 border">
<a href="add-blogs.php?add" class="btn btn-primary">Add Blog</a>
<?php
if ($_GET['Successfuly']) {?>
<p style="color: green;"><?=$msg?></p>
<?php }
else{
}?>
</div>
<table class="table border">
<thead>
<tr>
<th>S.No</th>
<th>Heading</th>
<th>Images</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
$blogs=mysqli_query($conn,"select * from blog ORDER BY `id` DESC");
while($row=mysqli_fetch_assoc($blogs)){
?>
<tr>
<td><?=$i++?></td>
<td><?=$row['blog_name']?></td>
<td><img src="uploads/<?=$row['image']?>" style="width: 50px; height: 50px;"></td>
<td>
<?php
if ($row['status']=='1') {
echo "<span class='btn btn-info btn-sm' style='color:#fff;'><a href='?status=0&id=".$row['id']."'>Active</a></span>";
}else{
echo "<span class='btn btn-warning btn-sm'><a href='?status=1&id=".$row['id']."'>Disable</a></span>";
}
?>
</td>
<td>
<a href="add-blogs.php?id=<?=$row['id']?>" class="btn btn-success btn-sm">Edit</a>
<a href="view-blogs.php?delete=<?=$row['id']?>" class="btn btn-danger btn-sm">Delete</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</section>
<div class="clearfix"></div>
<div class="menuitems" id="menuitems"></div>
<footer>
<div class="adm-ftr">
<div class="ftr-pnl" align="center">
COPYRIGHT © HIMANSHU ART INSTITUTE, ALL RIGHTS RESERVED
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous">
// Example starter JavaScript for disabling form submissions if there are invalid fields
(() => {
'use strict'
// Fetch all the forms we want to apply custom Bootstrap validation styles to
const forms = document.querySelectorAll('.needs-validation')
// Loop over them and prevent submission
Array.from(forms).forEach(form => {
form.addEventListener('submit', event => {
if (!form.checkValidity()) {
event.preventDefault()
event.stopPropagation()
}
form.classList.add('was-validated')
}, false)
})
})()
</script>
<script src="ckeditor/ckeditor.js"></script>
<script>
CKEDITOR.replace("short_des");
CKEDITOR.replace("long_des");
</script>
<script>
function hideR()
{
document.getElementById("record").style.display="none";
}
var record = document.getElementById("record");
window.addEventListener('mouseup',function(event){
if(event.target != record && event.target.parentNode != record)
{
record.style.display="none";
}
});
</script>
</body>
</html>