<?php 
session_start();
$iduser= $_SESSION['user_idd'];
$date = new DateTime("now", new DateTimeZone('Africa/Nairobi') );
$timenow=$date->format('Y-m-d H:i:s');
$timenow2=$date->format('Y-m-d');
$month=$date->format('M');
//$finaldate='Today: '.$date->format('l d M Y - H:i:s');

include('../include/config.php');




if(isset($_POST["id"]))
 {
$id=addslashes($_POST["id"]);
$namm='';

$sqll = "select * FROM Staffs where id='$id'";
$result = $con->query($sqll);
while($row = $result->fetch_assoc()) 
{
$namm=$row["Name"]; 
}

$sql=mysqli_query($con,"DELETE FROM users where userid='$id'");
if($sql)
{
$msgg='removed '.$namm.' as system user';
$sql3=mysqli_query($con,"INSERT INTO activity(user,Action,Tim,Dat,shortmsg,Month)values('$iduser','$msgg','$timenow','$timenow2','delete','$month')");
if($sql3)
{ }
echo "success";

}else
{
echo "Unable to delete the details";
}
}
?>