<?php session_start(); error_reporting(0); 
if(isset($_SESSION['j_admin'])){ }else{ 
    die(
    "
    <div class='alert alert-danger'> Error 100. Try again.</div>
    "
    );
}
require_once("../j_conn/url.php");
require_once("../j_conn/dbc.php");
require_once("../j_incs/functions.php");
if(isset($_POST['r_id'])){ }else{ 
die(
"
<div class='alert alert-danger'> Error 101. Try again.</div>
"
);
}

$ref = RMC($_POST["r_id"]); 
if(!empty($ref) 
 //&& !empty($ref)
 ){ //check if required field is not empty
	 
 }else{
	 die("<div class='alert alert-danger'> A required field is empty.</div>");
 } 
 
$sql4="SELECT * from j_blog WHERE j_id='".$ref."' AND j_deleted < 1"; //check 
$result4 = runSQL($sql4);
$data4 = mysqli_fetch_array($result4);
$ref = $data4['j_id'];
if(empty($ref)){
	die("<div class='alert alert-danger'> Invalid Reference.</div>");
}

$ip = getIPAddress();
$sql = "UPDATE j_blog SET
j_deleted ='1'
WHERE j_id='".$ref."' AND j_deleted < 1
";
$result = runSQL($sql);
if(!$result){
	die("<div class='alert alert-danger'> Error 1004. Try again.</div>
	");
}

$u_message ="<p>News has been deleted successfully.</p>";
?>
<h4 align="center">
	<i class='fa fa-check-circle r_icon text-success'></i>
	<br/>
	Successful.
</h4>
<script>
	$(".del_div").hide();
	$("#i<?php echo $ref; ?>").hide();
</script>