<?PHP
include "../inc/var.php";
include "../inc/connect.php";
include $server_inc."/whm_functions.php";
include $server_inc."/client_functions.php";
include $server_inc."/login_functions.php";

// get the server IP
$rsip=mysql_fetch_row(mysql_query("select server_ip, server_name from server_config where whm_id='".addslashes(trim($whm_id))."'"));
$server_ip=trim($rsip[0]);
$server_name=trim($rsip[1]);

if (isset($submit))
	{
	mysql_query("delete from user where uid='".addslashes(trim($uid))."'");
	}

include $server_admin_inc."/header.php";

echo("
	<form action='".$PHP_SELF."' method='POST'>
	<input type='hidden' name='sid' value='".trim($sid)."'>
	<input type='hidden' name='whm_id' value='".trim($whm_id)."'>
	<table width='725' cellpadding='0' cellspacing='0' border='0'>
		<tr>
			<td width='1%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='375'></td>
			<td width='99%' align='left' valign='top'>
			<table width='100%' cellpadding='2' cellspacing='0' border='0'>
				<tr>
					<td colspan='2' align='left' valign='top'><img src='".$http_images."/menu_arrow.gif'><b>Delete User from Database</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<a href='".$http_admin."/csv.php?sid=".$sid."&whm_id=".$whm_id."'>Go Back</a>]</td>
				</tr>
				<tr>
					<td colspan='2' align='left' valign='top'><img src='".$http_images."/space.gif' width='1' height='2'></td>
				</tr>
				<tr>
					<td colspan='2' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'><img src='".$http_images."/drop_arrow.gif'> You are currently working with the server: <b>".$server_name."</b></td>
				</tr>
				<tr>
					<td colspan='2' align='left' valign='top'><img src='".$http_images."/space.gif' width='1' height='12'></td>
				</tr>
				<tr>
					<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Choose User:</td>
					<td width='75%' align='left' valign='top'>
					<select name='uid' ".$input_style.">
	");
$row=mysql_query("select uid, first_name, last_name, zip_code, status, username from user where reseller='0' order by first_name asc, last_name asc");
while ($rs=mysql_fetch_row($row))
	{
	if ($rs[4]!=69)
		{
		echo "<option value='".$rs[0]."'".((isset($uid))?"".(($uid==$rs[0])?" selected":"")."":"").">[".stripslashes(trim($rs[3]))."] [".stripslashes(trim($rs[5]))."] ".stripslashes(trim($rs[1]))." ".stripslashes(trim($rs[2]))."</option>\n";
		}
	}
echo("
					</select>&nbsp;&nbsp;&nbsp;<input ".$button_style." type='submit' name='submit' value='Delete'></td>
				</tr>
				<tr>
					<td colspan='2' align='left' valign='top'><img src='".$http_images."/space.gif' width='1' height='4'></td>
				</tr>
				<tr>
					<td width='25%' align='left' valign='top'></td>
					<td width='75%' align='left' valign='top'><font color='#990000'><b>* This tool only deletes the user account.</b></font></td>
				</tr>
				<tr>
					<td width='25%' align='left' valign='top'></td>
					<td width='75%' align='left' valign='top'><font color='#990000'><b>* If used incorrectly it can wreck your database.</b></font></td>
				</tr>
				<tr>
					<td width='25%' align='left' valign='top'></td>
					<td width='75%' align='left' valign='top'><font color='#990000'><b>* Should only be used to clean junk user records.</b></font></td>
				</tr>
				<tr>
					<td width='25%' align='left' valign='top'></td>
					<td width='75%' align='left' valign='top'><font color='#990000'><b>* Using this tool is a bad idea, you've been warned...</b></font></td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
	</form>
	");

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