<?php


include("../include/session.php");

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$username = mysql_real_escape_string($_GET['user_name']);
$userid = $_GET['userid'];
$access_id = $_GET['access_id'];

$table_name = $_SESSION['db_prefix']."_users";
$del_user_query  = "DELETE FROM $table_name WHERE userid = '".$userid."' ";
execsql($del_user_query);

$table_name = $_SESSION['db_prefix']."_permissions";
$del_permissions_query  = "DELETE FROM $table_name WHERE access_id = '".$access_id."' ";
execsql($del_permissions_query);


$user_id = $_SESSION['username'];

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$table_name = $_SESSION['db_prefix']."_tracking_admin";
$trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '2', '".$username."' ,'','','' )";
$trackingResult = mySQL_query($trackingQuery);
?>
<script language="javascript" type="text/javascript">
          window.location="user_list.php";
</script>

															  