<?PHP
echo("
<table width='725' border='0' cellspacing='1' cellpadding='2'>
	");
if (trim($show_account)=="1")
	{
	echo("
		<form action='".$PHP_SELF."' method='POST'>
		<input type='hidden' name='sid' value='".trim($sid)."'>
		<input type='hidden' name='oid' value='".trim($oid)."'>
		".((trim($afuid)!="")?"<input type='hidden' name='afuid' value='".$afuid."'>":"")."
		".((trim($afdid)!="")?"<input type='hidden' name='afdid' value='".$afdid."'>":"")."
		".((isset($in))?"<input type='hidden' name='in' value='".$in."'>":"")."
		".((isset($ix))?"<input type='hidden' name='ix' value='".$ix."'>":"")."
		".((isset($p))?"<input type='hidden' name='p' value='".$p."'>":"")."
		<input type='hidden' name='show_client' value='".trim($show_client)."'>
		<input type='hidden' name='show_domain' value='".trim($show_domain)."'>
		<input type='hidden' name='show_account' value='".trim($show_account)."'>
		<input type='hidden' name='uid' value='".trim($uid)."'>
		<input type='hidden' name='domain_name' value='".trim($domain_name)."'>
		<input type='hidden' name='status' value='".trim($status)."'>
		<input type='hidden' name='domain_registration' value='".trim($domain_registration)."'>
		".((isset($pg))?"<input type='hidden' name='pg' value='".$pg."'>":"")."
		");
	}
echo("
	<tr>
		<td width='49%' align='left' valign='top'><img src='".$http_images."/menu_arrow.gif'><b>Hosting Account Information</b><img src='".$http_images."/space.gif' width='135' height='1'></td>
		<td width='51%' align='left' valign='top'>[<a href='".$http_admin."/client_view.php?sid=".trim($sid)."&oid=".trim($oid)."".((trim($show_account)=="1")?"&show_account=0":"&show_account=1")."&show_client=".trim($show_client)."&show_domain=".trim($show_domain)."".((isset($in))?"&in=5":"")."".((isset($ix))?"&ix=5":"")."".((isset($p))?"&p=".$p."":"")."".((isset($pg))?"&pg=".$pg."":"")."'>".((trim($show_account)=="0")?"Show":"Hide")."</a>]</td>
	</tr>
</table>
	");
if (trim($show_account)=="1")
	{
	if (trim($order_status)=="0")
		{
		$installed_server="Account is pending.";
		}
	else
		{
		$rs2=mysql_fetch_row(mysql_query("select server_name from server_config where whm_id='".addslashes(trim($whm_id))."'"));
		$installed_server=$rs2[0];
		}
	$xxx=date("m/d/Y", $next_due_date);
	if ($xxx=="12/31/1969"||trim($xxx)=="") { $xxxBit=true; unset($xxx); }

	$yyy=date("m/d/Y", $ogcreate_hosting);
	if ($yyy=="12/31/1969"||trim($yyy)=="") { $yyyBit=true; unset($yyy); }
	echo("
	<table width='725' border='0' cellspacing='1' cellpadding='2'>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Account Next Due On:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='15' maxlength='255' type='text' name='next_due_date' value='".$xxx."'>".((isset($xxxBit))?" <font color='#990000'><b>&lt; - Must Enter Manually - &gt;</b></font>":"")." ex. MM/DD/YYYY</td>
		</tr>
		<tr".((isset($yyyBit))?" border='1' bordercolor='#990000'":"").">
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Account Created on:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='15' maxlength='255' type='text' name='ogcreate_hosting' value='".$yyy."'>".((isset($yyyBit))?" <font color='#990000'><b>&lt; Must Enter Manually &gt;</b></font>":"")." ex. MM/DD/YYYY</td>
		</tr>
		
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Manage Account:</td>
			<td width='75%' align='left' valign='top'><select name='manage_account' ".$input_style.">
		");
	if (!isset($manage_account)) { $manange_account=1; }
	// ----------------------------------------------------------------------------

	/* manage account defined
	
	$manange_account==0	[xstatus==0]	Activate Account - Do Not Install
	$manange_account==1	[xstatus==0]	Activate Account - Install Now

	$manange_account==2	[All]			Suspend Account

	$manange_account==3	[All]			Delete Account

	$manange_account==4	[All]			Delete Account in MIB only

	$manange_account==5	[xstatus==2]	Unsuspend Account
	$manange_account==5	[xstatus==5]	Reactivate Account

	$manange_account==6	[xstatus==5]	Keep Account Cancelled

	$manange_account==7	[xstatus==4]	Activate Account - Keep Account Active
	*/

	// ----------------------------------------------------------------------------

	if (trim($xstatus)=="0")
		{
		echo("
		<option value='0'".((trim($manage_account)=="0")?" selected":"").">Activate Account - Do Not Install</option>

		<option value='1'".((trim($manage_account)=="1")?" selected":"").">Activate Account - Install Now</option>

		<option value='2'".((trim($manage_account)=="2")?" selected":"").">Suspend Account</option>

		<option value='3'".((trim($manage_account)=="3")?" selected":"").">Delete Account</option>

		<option value='4'".((trim($manage_account)=="4")?" selected":"").">Delete Account in AutoPilot only</option>
			");
		}
	else if (trim($xstatus)=="1"||trim($xstatus)=="4")
		{
		echo("
		<option value='7'".((trim($manage_account)=="0")?" selected":"").">Keep Account Active</option>
		<option value='2'".((trim($manage_account)=="2")?" selected":"").">Suspend Account</option>

		<option value='3'".((trim($manage_account)=="3")?" selected":"").">Delete Account</option>

		<option value='4'".((trim($manage_account)=="4")?" selected":"").">Delete Account in AutoPilot only</option>
			");
		}
	else if (trim($xstatus)=="2")
		{
		echo("
		<option value='2'".((trim($manage_account)=="2")?" selected":"").">Keep Account Suspended</option>
		<option value='5'".((trim($manage_account)=="5")?" selected":"").">Unsuspend Account</option>

		<option value='3'".((trim($manage_account)=="3")?" selected":"").">Delete Account</option>

		<option value='4'".((trim($manage_account)=="4")?" selected":"").">Delete Account in AutoPilot only</option>
			");
		}
	else if (trim($xstatus)=="5")
		{
		echo("
		<option value='6'".((trim($manage_account)=="6")?" selected":"").">Keep Account Cancelled</option>
		<option value='5'".((trim($manage_account)=="5")?" selected":"").">Reactivate Account</option>

		<option value='3'".((trim($manage_account)=="3")?" selected":"").">Delete Account</option>

		<option value='4'".((trim($manage_account)=="4")?" selected":"").">Delete Account in AutoPilot only</option>
			");
		}
		echo("
				</select></td>
		</tr>
			");
	if ($phpbb_active=="yes")
		{
		echo("
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Manage PHPBB User:</td>
			<td width='75%' align='left' valign='top'><select name='manage_phpbb' ".$input_style.">
		<option value='0'".((trim($manage_phpbb)=="0")?" selected":"").">No changes</option>

		<option value='1'".((trim($manage_phpbb)=="1")?" selected":"").">Suspend User</option>

		<option value='2'".((trim($manage_phpbb)=="2")?" selected":"").">Delete User</option></select></td>
		</tr>
			");
		}
		echo("
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Hosting Package:</td>
			<td width='75%' align='left' valign='top'><select name='xpid' ".$input_style.">
		");
	$row2=mysql_query("select pid, package_name, monthly_cost, quarterly_cost, semi_annual_cost, annual_cost from plan_specs where dedicated='0' order by package_name asc");
	while ($rs2=mysql_fetch_row($row2))
		{
		$rs2[0]=trim($rs2[0]);
		$payment_term=str_replace("-", "_", strtolower($payment_term));
		
		if ($rs2[2]!=-1)
			{
			echo"<option value='".$rs2[0]."|monthly'".(($pid."|".$payment_term===$rs2[0]."|monthly")?" selected":"").">".$rs2[1]." - ".$rs2[2]." Monthly</option>\n";
			}
		if ($rs2[3]!=-1)
			{
			echo"<option value='".$rs2[0]."|quarterly'".(($pid."|".$payment_term===$rs2[0]."|quarterly")?" selected":"").">".$rs2[1]." - ".$rs2[3]." Quarterly</option>\n";
			}
		if ($rs2[4]!=-1)
			{
			echo"<option value='".$rs2[0]."|semi_annual'".(($pid."|".$payment_term===$rs2[0]."|semi_annual")?" selected":"").">".$rs2[1]." - ".$rs2[4]." Semi-Annually</option>\n";
			}
		if ($rs2[5]!=-1)
			{
			echo"<option value='".$rs2[0]."|annual'".(($pid."|".$payment_term===$rs2[0]."|annual")?" selected":"").">".$rs2[1]." - ".$rs2[5]." Annually</option>\n";
			}
		}
	echo("
			</select></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Install on Server:</td>
			<td width='75%' align='left' valign='top'><select name='whm_id' ".$input_style.">
		");
	$row1=mysql_query("select whm_id, server_name from server_config order by server_name asc");
	while ($rs1=mysql_fetch_row($row1))
		{
		echo"<option value='".$rs1[0]."'".((isset($whm_id))?"".(($whm_id==$rs1[0])?" selected":"")."":"").">".$rs1[1]."</option>\n";
		}
	echo("
			</select></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>cPanel Username:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='15' maxlength='255' type='text' name='whm_username' value='".trim($whm_username)."'> [<a href='http://".$whm_username.":".$whm_password."@".$domain_name."/cpanel' target='_blank'>visit cPanel</a>]</td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>cPanel Password:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='15' maxlength='255' type='text' name='whm_password' value='".trim($whm_password)."'> <font color='#990000'>* Will not change in WHM</font></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Client Area Username:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='15' maxlength='255' type='text' name='client_username' value='".trim($client_username)."'> [<a href='".$http_web."/clogin.php?sid=".$client_sid."' target='_blank'>visit client area</a>]</td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Client Area Password:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='15' maxlength='255' type='text' name='client_password' value=''> <font color='#990000'>* Will always show blank</font></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>IP Address:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='43' maxlength='255' type='text' name='ip' value='".trim($ip)."'></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Primary NS:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='43' maxlength='255' type='text' name='ns1' value='".trim($ns1)."'></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Secondary NS:</td>
			<td width='75%' align='left' valign='top'><input ".$input_style." size='43' maxlength='255' type='text' name='ns2' value='".trim($ns2)."'></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Current Payment Type:</td>
			<td width='75%' align='left' valign='top'>
			<select name='payment_method' ".$input_style.">
		");
	$rspmx=mysql_query("select pid, name from payment_process order by name asc");
	while($rspm=mysql_fetch_row($rspmx))
		{
		echo"<option value='".$rspm[0]."'".(($payment_method==$rspm[0])?" selected":"").">".$rspm[1]."</option>\n";
		}
	echo("
			</select>
			</td>
		</tr>
		");

	echo("
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Package Addons:</td>
			<td width='75%' align='left' valign='top'>
			<table width='100%' cellpadding='0' cellspacing='0'>
		");

	// added 4/24/2003 Rockwell
	if ($addon_gid!=0)
		{
		$count=substr_count($addon_choices, "|");
		$explode=explode("|", $addon_choices);

		// select all addons for the set
		$query="select ";
		$query.="group_addons ";				// 0
		$query.="from addon_groups ";
		$query.="where addon_gid='".addslashes(trim($addon_gid))."'";

		$rs=mysql_fetch_row(mysql_query($query));
		$group_addons=stripslashes(trim($rs[0]));

		$ii=0;
		$x=0;
		$tok=strtok($group_addons, "|");
		while ($tok)
			{
			if (trim($addon_choices)!="") { for ($i=0; $i<=$count; $i++) { if ($explode[$i]==$tok) { $bit=true; } }	}

			$query0.="select ";
			$query0.="addon_name, ";				// 0
			$query0.="addon_description, ";			// 1
			$query0.="addon_show_description, ";	// 2
			$query0.="setup_cost, ";				// 3
			$query0.="setup_activate, ";			// 4
			$query0.="addon_cost, ";				// 5
			$query0.="addon_state, ";				// 6
			$query0.="addon_activate, ";			// 7
			$query0.="coupon, ";					// 8
			$query0.="private_ns ";					// 9
			$query0.="from addon_specs ";
			$query0.="where aid='".addslashes(trim($tok))."'";

			$rs0=mysql_fetch_row(mysql_query($query0));

			$addon_name=stripslashes(trim($rs0[0])); 
			$addon_description=stripslashes(trim($rs0[1]));
			$addon_show_description=stripslashes(trim($rs0[2]));
			$setup_cost=stripslashes(trim($rs0[3])); 
			$setup_activate=stripslashes(trim($rs0[4]));
			$addon_cost=stripslashes(trim($rs0[5]));
			$addon_state=stripslashes(trim($rs0[6]));
			$addon_activate=stripslashes(trim($rs0[7]));
			$coupon=stripslashes(trim($rs0[8]));
			$private_ns=stripslashes(trim($rs0[9]));

			echo("	
				<tr>
					<td align='left' valign='middle'><input type='checkbox' name='aid".$ii."' value='".$tok."'".((isset($bit))?" checked":"")."></td>
					<td align='left' valign='middle'>
				");
			if ($addon_show_description==1)
				{
				$addon_description=preg_replace("/[^A-Za-z0-9 ]/", "", strip_tags($addon_description));
				$addon_name=preg_replace("/[^A-Za-z0-9 ]/", "", strip_tags($addon_name));
				echo"&nbsp;<A HREF='javascript:void(0)' class='cleanlink3' onmouseover=\"return overlib('".$addon_description."', CAPTION, '".$addon_name."');\" onmouseout='nd();'>".$addon_name."</a>";
				}
			else
				{
				echo "&nbsp;".$addon_name;
				}
			echo("
					</td>
					<td align='left' valign='middle'>&nbsp;
				");
			if ($setup_activate==1&&$coupon==0) { echo $currency.sprintf("%01.2f", $setup_cost).$currency_type." Setup Fee"; }
			else if ($coupon==0) { echo "No Setup Fee"; }
			echo("
					</td>
					<td align='left' valign='top' bgcolor='".$bgcolor."'>&nbsp;
				");
			if ($addon_activate==1&&$coupon==0) 
				{
				echo $currency.sprintf("%01.2f", $addon_cost).$currency_type;
				if ($addon_state==1) { echo " One Time Fee"; }
				else if ($addon_state==2) { echo " Per Month"; }
				else if ($addon_state==3) { echo " Per Year"; }
				}
			else if ($coupon==0)
				{ 
				echo "No Cost for Addon"; 
				}
			echo("
					</td>
				</tr>
				");










				# Reseller Code added 7/2/2003 - Rockwell
				# ---------------------------------------------------------------------------
				# private ns addon?
				if ($private_ns==1)
					{
					$sq="select ";
					$sq.="plan_specs.rid, ";
					$sq.="hosting_order.domain_name, ";
					$sq.="hosting_order.pns1, ";
					$sq.="hosting_order.pns2 ";
					$sq.="from ";
					$sq.="hosting_order, plan_specs ";
					$sq.="where ";
					$sq.="hosting_order.oid='".addslashes(trim($oid))."' ";
					$sq.="and ";
					$sq.="hosting_order.pid=plan_specs.pid ";
					$sq.="order by hosting_order.pid asc ";
					$sq.="limit 0, 1";

					$rsq=mysql_fetch_row(mysql_query($sq));
					
					# reseller package?
					if ($rsq[0]!=0)
						{
						# admin allow custom prefix?
						$qq="select ";
						$qq.="edit_ns ";
						$qq.="from ";
						$qq.="reseller_profile ";
						$qq.="where ";
						$qq.="rid='".addslashes(trim($rsq[0]))."' ";
						$qq.="limit 0, 1";
						
						$rqq=mysql_fetch_row(mysql_query($qq));
						
						if ($rqq[0]==1)
							{
							# good buffered code here
							echo("
								<tr>
									<td colspan='1'></td>
									<td colspan='3'>&nbsp;<input ".$input_style." size='3' maxlength='25' type='text' name='pns1' value='".$rsq[2]."'>.".$rsq[1]."</td>
								</tr>
								<tr>
									<td colspan='1'></td>
									<td colspan='3'>&nbsp;<input ".$input_style." size='3' maxlength='25' type='text' name='pns2' value='".$rsq[3]."'>.".$rsq[1]."</td>
								</tr>
								");
							}
						}
					}
				# ---------------------------------------------------------------------------
				# Reseller Code added 7/2/2003 - Rockwell

















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

			unset($bit);
			unset($xtok);
			unset($addon_name);
			unset($addon_description);
			unset($addon_show_description);
			unset($setup_cost);
			unset($setup_activate);
			unset($addon_cost);
			unset($addon_state);
			unset($addon_activate);
			unset($query0);
			unset($rs0);

			$ii++;

			$tok=strtok("|");
			}

		echo "</table>";
		}

	echo("
				<tr>
					<td colspan='1' align='left' valign='middle'></td>
					<td colspan='3' align='left' valign='middle'><select name='domain_registration' ".$input_style.">
					<option value='0'>We did not register this domain</option>
		");

	# ----------------------------------------------------------------------------

		$query="select ";
		$query.="reg_period, ";
		$query.="tld,";
		$query.="tld_id, ";
		$query.="cost ";
		$query.="from ";
		$query.="tld_chart ";
		$query.="order by tld asc";
		$row=mysql_query($query);
		while ($rs=mysql_fetch_row($row))
			{
			$reg_period=$rs[0];
			$tld=$rs[1];
			$xtld_id=$rs[2];
			$cost=$currency.sprintf("%01.2f", $rs[3])." ".$currency_type;

			if ($reg_period==1) { $reg_period="Domain registration for 1 year. [.".$tld."] [".$cost."] \n";	}
			else if ($reg_period==2) { $reg_period="Domain registration for 2 years. [.".$tld."] [".$cost."]\n";	}
			else if ($reg_period==3) { $reg_period="Domain registration for 5 years. [.".$tld."] [".$cost."]\n";	}
			else if ($reg_period==4) { $reg_period="Domain registration for 10 years. [.".$tld."] [".$cost."]\n";	}
			
			if ($xtld_id==$tld_id) { $style=" style='background-color: #F3F4F5;'"; }
			else { $style=""; }

			echo "<option value='".$xtld_id."'".(($xtld_id==$tld_id)?" selected":"")."".$style.">";
			echo $reg_period;
			echo "</option>";

			unset($reg_period);
			unset($tld);
			unset($xtld_id);
			unset($cost);
			}

	echo("
				</select></td>
				</tr>
			</td>
		</tr>
		");
	// end added 4/24/2003 Rockwell
	echo("
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Client Notes:</td>
			<td width='75%' align='left' valign='top'><textarea name='client_notes' ".$input_style." rows='4' cols='42'>".((isset($client_notes))?"".$client_notes."":"None Recorded")."</textarea></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Private Admin Notes:</td>
			<td width='75%' align='left' valign='top'><textarea name='admin_notes' ".$input_style." rows='4' cols='42'>".((isset($admin_notes))?"".$admin_notes."":"None Recorded")."</textarea></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'>Email Options:</td>
			<td width='75%' align='left' valign='top'><input type='checkbox' name='resend_welcome' value='1' id='resend_welcome'> <label for='resend_welcome'>Check to resend the welcome email for this client.</label></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='15' height='9'></td>
			<td width='75%' align='left' valign='top'><input type='checkbox' name='resend_dns' value='1' id='resend_dns'> <label for='resend_dns'>Check to resend the DNS Config email for this client.</label></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'><img src='".$http_images."/space.gif' width='200' height='2'></td>
			<td width='75%' align='left' valign='top'><img src='".$http_images."/space.gif' width='400' height='2'></td>
		</tr>
		<tr>
			<td width='25%' align='left' valign='top'></td>
			<td width='75%' align='left' valign='top'><input ".$button_style." type='submit' name='edit_account' value='Update Account Information Now'></td>
		</tr>
	</table>
	</form>
		");
	}
// end the hosting account
?>