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

// Start Form Handler

if (isset($delete))
	{
	mysql_query("delete from plan_specs where pid='".addslashes(trim($delete))."'");
	}

// End Form Handler

echo("
	<form action='".$PHP_SELF."' method='POST'>
	".((isset($pid))?"<input type='hidden' name='pid' value='".trim($pid)."'>":"")."
<!--- Start Header --->
	<table width='100%' cellpadding='2' cellspacing='0' border='0'>
		<tr>
			<td align='left' valign='top'><a href='".$http_admin."/index.php'><img border='0' src='".$http_images."/menu_arrow_back.gif'></a>Edit Package Specs</td>
			<td align='right' valign='top'><font size='1'>Today is ".date("l F d Y").", the current time is: ".date("h:i:s a")."</font></td>
		</tr>
		<tr>
			<td colspan='2' align='left' valign='top'><hr></td>
		</tr>
		<tr>
			<td align='left' valign='top'><img border='0' src='".$http_images."/space.gif' width='190' height='1'></td>
			<td align='left' valign='top'><img border='0' src='".$http_images."/space.gif' width='403' height='1'></td>
		</tr>
	</table>
<!--- End Header --->

<!--- Start Main --->
<table width='100%' border='0' cellspacing='1' cellpadding='2'>
		<tr>
			<td align='center' valign='top' bgcolor='#E5E7E9'><b>#</b></td>
			<td align='left' valign='top' bgcolor='#E5E7E9'><b>Package Group</b></td>
			<td align='left' valign='top' bgcolor='#E5E7E9'><b>Package Name</b></td>
			<td align='left' valign='top' bgcolor='#E5E7E9'><b>Web Space</b></td>
			<td align='left' valign='top' bgcolor='#E5E7E9'><b>Bandwidth</b></td>
			<td align='center' valign='top' bgcolor='#E5E7E9'><b>Edit</b></td>
			<td align='center' valign='top' bgcolor='#E5E7E9'><b>Delete</b></td>
		</tr>
	");

$x=1;
$y=1;
$row=mysql_query("select plan_specs.pid, plan_specs.package_name, plan_specs.web_space, plan_specs.bandwidth, plan_groups.name from plan_specs, plan_groups where plan_specs.gid=plan_groups.gid order by plan_groups.name, plan_specs.package_name asc");
while ($rs=mysql_fetch_row($row))
	{
	if ($y==1) {$bgcolor="#F2F4F6"; $y=0;} else {$bgcolor="#ECEEF0"; $y=1;}
	echo("
		<tr>
			<td align='center' valign='top' bgcolor='".$bgcolor."'>".$x.").</td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>".stripslashes($rs[4])."</td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>".stripslashes($rs[1])."</td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>".$rs[2]." MB</td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>".$rs[3]." MB</td>
			<td align='center' valign='top' bgcolor='".$bgcolor."'>[ <a href='".$http_admin."/plan_build.php?pid=".$rs[0]."'>click</a> ]</td>
			<td align='center' valign='top' bgcolor='".$bgcolor."'>[ <a href='".$PHP_SELF."?delete=".$rs[0]."'>click</a> ]</td>
		</tr>
		");
	$x++;
	}

$uy=1;
$row=mysql_query("select pid, package_name, web_space, bandwidth from plan_specs where gid='0' order by package_name asc");
while ($rs=mysql_fetch_row($row))
	{
	if ($uy==1) {$bgcolor="#F2F4F6"; $uy=0;} else {$bgcolor="#ECEEF0"; $uy=1;}
	echo("
		<tr>
			<td align='center' valign='middle' bgcolor='".$bgcolor."'><a href='".$http_admin."/plan_build.php?pid=".$rs[0]."'><img border='0' src='".$http_images."/".(($uy==1)?"exec_ECEEF0.gif":"exec_F2F4F6.gif")."' alt='Click for Details'></a></td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>Undefined</td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>".stripslashes($rs[1])."</td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>".$rs[2]." MB</td>
			<td align='left' valign='top' bgcolor='".$bgcolor."'>".$rs[3]." MB</td>
			<td align='center' valign='top' bgcolor='".$bgcolor."'>[ <a href='".$http_admin."/plan_build.php?pid=".$rs[0]."'>click</a> ]</td>
			<td align='center' valign='top' bgcolor='".$bgcolor."'>[ <a href='".$PHP_SELF."?delete=".$rs[0]."'>click</a> ]</td>
		</tr>
		");
	}
echo("
</table>
</form>
<!--- End Main --->

	");
// End Main Process
mysql_close($dblink);
?>