<?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";
include $server_inc."/invoice_functions.php";
include $server_admin_inc."/header.php";

echo("
	<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='725' cellpadding='2' cellspacing='1' border='0'>
				<tr>
					<td colspan='5' align='left' valign='top'><img src='".$http_images."/menu_arrow.gif'><b>Non Hosting Clients</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<a href='".$http_admin."/invoice.php?sid=".$sid."'><font color='#990000'>Back</font></a>]</td>
				</tr>
				<tr>
					<td colspan='5' align='left' valign='top'><hr color='#F0EFED'></td>
				</tr>
			</table>
			<table width='725' cellpadding='4' cellspacing='1' border='0'>
				<tr>
					<td width='10%' align='center' valign='middle' bgcolor='#E5E7E9'>&nbsp;<b>#</b></td>
					<td width='50%' align='left' valign='middle' bgcolor='#E5E7E9'>&nbsp;<b>Client Name</b></td>
					<td width='35%' align='left' valign='middle' bgcolor='#E5E7E9'>&nbsp;<b>Client Email</b></td>
					<td width='15%' align='left' valign='middle' bgcolor='#E5E7E9'>&nbsp;<b>Actions</b>&nbsp;</td>
				</tr>
				");

			$query="select ";
			$query.="uid, ";		// 0
			$query.="first_name, ";	// 1
			$query.="last_name, ";	// 2
			$query.="email, ";		// 3
			$query.="status, ";		// 4
			$query.="zip_code ";	// 5
			$query.="from user ";
			$query.="order by first_name asc";
			
			$row=mysql_query($query);
			while ($rs=mysql_fetch_row($row))
				{
				$uid=stripslashes(trim($rs[0]));
				$first_name=stripslashes(trim($rs[1]));
				$last_name=stripslashes(trim($rs[2]));
				$email=stripslashes(trim($rs[3]));
				$status=stripslashes(trim($rs[4]));
				$zip_code=stripslashes(trim($rs[5]));
				
				$ct=mysql_fetch_row(mysql_query("select count(*) from hosting_order where uid='".addslashes(trim($uid))."'"));
	
				if ($status!=69&&$ct[0]<=0)
					{
					if ($y==1) { $bgcolor="#F2F4F6"; $y=0; } else { $bgcolor="#ECEEF0"; $y=1; }

					echo("
						<tr>
							<td width='10%' align='center' valign='top' bgcolor='#E5E7E9'><b>".($x+=1)."</b></td>
							<td width='50%' align='left' valign='top' bgcolor='".$bgcolor."'>
							<table width='100%' cellpadding='0' cellspacing='0' border='0'>
								<tr>
									<td width='1%' align='center' valign='middle'>&nbsp;<a href='".$http_admin."/invoice_non_hosting_client_summary.php?sid=".$sid."&uid=".$uid."'><img src='".$http_images."/icon_view.gif' border='0'></a>&nbsp;&nbsp;</td>
									<td width='99%' align='left' valign='middle'><a href='".$http_admin."/invoice_client_editor.php?sid=".$sid."&uid=".$uid."'>".$first_name." ".$last_name." - ".$zip_code."</a></td>
								</tr>
							</table>
							</td>
							<td width='35%' align='left' valign='top' bgcolor='".$bgcolor."'>&nbsp;<a href='mailto:".$email."'>".$email."</a></td>
							<td width='15%' align='left' valign='top' bgcolor='".$bgcolor."'>&nbsp;[<a href='".$http_admin."/invoice_client_editor.php?sid=".$sid."&uid=".$uid."'>edit</a>]</td>
						</tr>
						");
					}
				}

	if (!isset($x))
		{
		echo("
					<tr>
						<td colspan='4'><img src='".$http_images."/space.gif' width='1' height='4'></td>
					</tr>
					<tr>
						<td colspan='4'><font color='#990000'>$x No non hosting users found in the database.</font></td>
					</tr>
			");
		}

	echo("
					<tr>
						<td colspan='4'><img src='".$http_images."/space.gif' width='1' height='16'></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		");

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