HEX
Server: Apache
System: Linux sg2plmcpnl492417.prod.sin2.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: nyiet8349bzl (9207396)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/nyiet8349bzl/Backup/sbc_back/homedir/public_html/bsadmin-portal/manage-news.php
<?php   
	include("../config/connection.php");
$connection = new createCon();
$connection->connect();
	if($_SESSION['admin']['user_id']=='')
	{
		echo "<script>window.location.href='index.php'</script>";
	}
	if(isset($_REQUEST['action'],$_REQUEST['id'],$_SESSION['admin']['user_id']) and ($_REQUEST['action']=='DeleteNews') and !empty($_REQUEST['id']) and !empty($_SESSION['admin']['user_id']))
	{
		$id=$_REQUEST['id'];
		$sql=mysqli_query($connection->myconn, "delete FROM news WHERE id ='".$id."'");
		if($sql==true)
		{	
			echo "<script>alert('News successfully deleted.')</script>";
			echo "<script>window.location='manage-news.php'</script>";
		}
	}
	if(isset($_REQUEST['action'],$_REQUEST['id'],$_SESSION['admin']['user_id']) and ($_REQUEST['action']=='UpdateStatus') and !empty($_REQUEST['id']) and !empty($_SESSION['admin']['user_id']))
	{
		$id=$_REQUEST['id'];
		$sql=mysqli_query($connection->myconn, "update news set status='2' where id='".$id."'");
		if($sql==true)
		{	
			echo "<script>alert('News add in archive successfully.')</script>";
			echo "<script>window.location='manage-news.php'</script>";
		}
	}
	
?>
<!doctype html>
<html class="fixed">
	<head>
		<title>News :: SBSC Admin</title>
		<?php include("inc-head.php");?>
	</head>
	<body>
		<section class="body">
			<!-- start: header -->
				<?php include("inc-header.php"); ?>
			<!-- end: header -->
			<div class="inner-wrapper">
				<!-- start: sidebar -->
					<?php include("inc-navigation.php"); ?>
				<!-- end: sidebar -->
				<section role="main" class="content-body">
					<header class="page-header">
						<h2>News Management</h2>
						<div class="right-wrapper pull-right">
							<ol class="breadcrumbs">
								<li>
									<a href="dashboard.php"><i class="fa fa-home"></i></a>
								</li>
								<li><span>News Management</span></li>
								<li><span>News List</span></li>
							</ol>
							<a class="sidebar-right-toggle"></a>
						</div>
					</header>
					<!-- start: page -->
					<section class="panel">
						<header class="panel-heading">
							<div class="panel-actions">
								<a href="#" class="panel-action panel-action-toggle" data-panel-toggle></a>
								<a href="#" class="panel-action panel-action-dismiss" data-panel-dismiss></a>
							</div>
							<h2 class="panel-title">News List</h2>
						</header>
						<div class="panel-body">
							<div class="row">
							</div>
							<table class="table table-bordered table-striped mb-none" id="example" >
								<thead>
									<tr>
										<th>News Title</th>
										<th>News Category</th>
										<th>Show PDF</th>
										<th width="18%">Actions</th>
									</tr>
								</thead>
								<tbody>
								<?php
								$sql = mysqli_query($connection->myconn, "SELECT * FROM news where status='1' order by created_on desc") or die(mysqli_error($connection->myconn));
								while($rows=mysqli_fetch_array($sql))
								{
									$createdOn=date('d M Y',strtotime($rows['created_on']));
								?>
									<tr>
										<td><?php echo $rows['name']; ?></td>
										<td><?php echo $rows['category']; ?></td>
										<td><?php echo $rows['image']; ?></td>
										<td class="actions">
											<a style="color:#0369a9;" href="edit-news.php?action=editNews&id=<?php echo $rows['id'] ?>" title="Edit News">
												<i class="fa fa-pencil fa-2x"></i>
											</a>&nbsp;&nbsp;
											<a  style="color:#FF0000;" href="manage-news.php?action=DeleteNews&id=<?php echo $rows['id'] ?>" title="Delete News" onClick="return confirm('Are you sure want to delete news ?')">
												<i class="fa fa-trash-o fa-2x"></i>
											</a>&nbsp;&nbsp;
											<a href="manage-news.php?action=UpdateStatus&id=<?php echo $rows['id'] ?>" title="Add Archive" onClick="return confirm('Are you sure want to add this news in archive ?')">
												<i class="fa fa-archive fa-2x"></i>
											</a>
										</td>
									</tr>
								<?php } ?>
								</tbody>
							</table>
						</div>
					</section>
					<!-- end: page -->
				</section>
			</div>
		</section>

		<?php include("inc-footer.php"); ?>
		<!-- Specific Page Vendor -->		
		<script src="assets/vendor/select2/js/select2.js"></script>		
		<script src="assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>	
		<script src="assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
		<!-- Theme Base, Components and Settings -->
		<script src="assets/javascripts/theme.js"></script>
		<!-- Theme Custom -->
		<script src="assets/javascripts/theme.custom.js"></script>
		<!-- Theme Initialization Files -->
		<script src="assets/javascripts/theme.init.js"></script>
		<!-- Examples -->
		<script src="assets/javascripts/tables/examples.datatables.editable.js"></script>
		<script>
			$(function()
			{
				$("#example").dataTable();
			})
		</script>
	</body>
</html>