<?php

session_start();
include "../config.php";
include "../header.php";
include "../style.php";
if( isset($_SESSION["alogin"]) ) {
$id = dbput($_POST['id']);

?><table>
<tr>
<td width="15%" valign=top><br>
<? include("adminnavigation.php"); ?>
</td>
<td valign="top" align="center"><br><br> <?
echo "<font size=2 face='$fonttype' color='$fontcolour'><p><b><center>";


//////////////////////////////////////////////////////////
//////////// E-mail notification to the Admin ////////////
/////////// Part of the Deleted members script ///////////
//////////////// Coded by Jonathan, v0.1 /////////////////
//////////////////////////////////////////////////////////
//Get the options of Leaves
$options = mysql_query ("select * from leaves_options where id='1'");
$array = mysql_fetch_array($options);
$scriptactive = $array["leave_active"];
$email = $array["leave_email"];
$logleaved = $array["log_leaved"];

if($scriptactive == 1)
{
$remark = "Deleted by Admin.";

if($logleaved == 1)
{
//Get the user's details and parse the parts needed so it can be injected
$userinfo=mysql_query ("select * from members where userid='".$userid."'");
$userrecord=mysql_fetch_array($userinfo);

$id=$userrecord["id"];
$name=$userrecord["name"];
$contact_email=$userrecord["contact_email"];
$userid=$userrecord["userid"];
$ip=$userrecord["ip"];
$joindate=$userrecord["joindate"];
$memtype=$userrecord["memtype"];
$today = date('Y-m-d',strtotime("now"));

//Insert the user's details into the database
$query1 = "insert into leaves (id, ip, name, username, memtype, contact_email, reason, joindate, deleted) values
('$id', '$ip', '$name', '$userid', '$memtype', '$contact_email', '$remark', '$joindate', '$today')";
$result1 = mysql_query ($query1);
}
}

delete_account($userid);

echo $userid." has been permanently deleted!";

echo "</td></tr></table>";
}

else  {
echo "Unauthorised Access!";
}

include "../footer.php";
mysql_close($dblink);
?>