<?
include('_db.connection.php');
include('_public.setup.php');

$mid = "0";
$access = "false";

$topnav = 4;
?>

	<script language="javascript">
	
	function js_signup() {
		if(document.signup.f_name.value == "") {
			alert("Please enter your first name.");
			return false;
		}
		if(document.signup.l_name.value == "") {
			alert("Please enter your last name.");
			return false;
		}
		if(document.signup.email.value == "") {
			alert("Please enter your email address.");
			return false;
		}
		if(document.signup.pass.value == "") {
			alert("Please enter your password.");
			return false;
		}
		if(document.signup.vpass.value == "") {
			alert("Please verify your password.");
			return false;
		}
		if(document.signup.pass.value != document.signup.vpass.value) {
			alert("The password and verify password fields do not match");
			return false;
		}
		document.signup.action = "actions.php?pmode=signup";
		document.signup.submit();
	}
	
	</script>


	<table cellpadding="0" cellspacing="0" width="780" border="0">
		<?php include("i.header.php"); ?>
		<tr>
			<td>
				<table cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td valign="top">
							<!--
							**************************
							**** BEGIN BODY TABLE ****
							**************************
							-->
							<table cellpadding="0" cellspacing="0">
								<?php include("i.login.header.php"); ?>
								<tr>
									<td colspan="2" align="center">
										<!--
										**************************
										*** BEGIN BODY CONTENT ***
										**************************
										-->
										
										<table width="90%">
										<?
										switch($smode){
											default:
										?>
											<form name="signup" method="post">
											<tr>
												<td><font face="verdana" color="#335F7A" style="font-size: 12;">
												<?
												$content_result = mysql_query("SELECT * FROM copy WHERE copy_id = 5", $db);
												$content = mysql_fetch_object($content_result);
												echo $content->copy;
												?>
												</td>
											</tr>
											<tr>
												<td>&nbsp;</td>
											</tr>
											<tr>
												<td style="border: 1px solid #083C58; padding: 10px" bgcolor="#F8F8F8">
													<table width="100%">
														<tr>														
															<td align="left"><font face="Verdana" style="font-size: 11;" color="#083C58"><b>First Name</b></td>
															<td><input type="text" name="f_name" value="<?php echo $fn; ?>" style="width: 300;font-size: 10;"></td>															
														</tr>														
														<tr>														
															<td align="left"><font face="Verdana" style="font-size: 11;" color="#083C58"><b>Last Name</b></td>															
															<td><input type="text" name="l_name" value="<?php echo $ln; ?>" style="width: 300;font-size: 10;"></td>															
														</tr>
														<?php if($error == "email"){ ?>
														<tr>
															<td colspan="2"><font face="Verdana" size="1" color="#ff0000">This email address is already in use. Please try another.</font> <font face="Verdana" size="1"><a href="#">[Forgot Password?]</a></td>
														</tr>
														<? } ?>													
														<tr>														
															<td align="left"><font face="Verdana" style="font-size: 11;" color="#083C58"><b>Email Address</b></td>															
															<td><input type="text" name="email" style="width: 300;font-size: 10;"></td>															
														</tr>														
														<tr>														
															<td align="left"><font face="Verdana" style="font-size: 11;" color="#083C58"><b>Password</b></td>															
															<td><input type="password" name="pass" style="width: 300;font-size: 10;"></td>															
														</tr>														
														<tr>														
															<td align="left"><font face="Verdana" style="font-size: 11;" color="#083C58"><b>Verify Password</b></td>															
															<td><input type="password" name="vpass" style="width: 300;font-size: 10;"></td>															
														</tr>
														<tr>
															<td colspan="2">&nbsp;</td>
														</tr>													
														<tr>														
															<td colspan="2">															
																<table cellpadding="0" cellspacing="0">
																	<?
																	if($sokey != ""){
																		$offer_result = mysql_query("SELECT * FROM offers where offer_key = '$sokey'");
																		$offer = mysql_fetch_object($offer_result);
																	?>
																	
																		<tr>
																			<td></td>																	
																			<td><font face="Verdana" style="font-size: 11;" color="#083C58"><b>Special Offer: <? echo $offer->name; ?></td>																	
																		</tr>
																		
																		<tr>																	
																			<td></td>																		
																			<td><font face="Verdana" style="font-size: 11;" color="#083C58"><?php echo $offer->bandwidth; ?>mb Transfer, Unlimited Image Storage, <? if($offer->portfolio == 1){ echo "Unlimited Portfolio Creation, "; } ?><? if($offer->portfolio == 1){ echo "Unlimited Slideshow Creation, "; } ?>Unlimited Auction Galleries, $<?php echo $offer->price; ?>/month</td>																	
																		</tr>
																		
																		<input type="hidden" name="plan" value="custom">
																		<input type="hidden" name="offer_id" value="<? echo $offer->offer_id; ?>">
																		<input type="hidden" name="bandwidth" value="<?php echo $offer->bandwidth; ?>">
																		<input type="hidden" name="portfolio" value="<?php echo $offer->portfolio; ?>">
																		<input type="hidden" name="slideshow" value="<?php echo $offer->slideshow; ?>">
																		<input type="hidden" name="branding" value="<?php echo $offer->branding; ?>">
																		<input type="hidden" name="sokey" value="<? echo $sokey; ?>">
																		<input type="hidden" name="price" value="<?php echo $offer->price; ?>">
																	
																	<?
																	}
																	else{
																	?>
																		<tr>
																			<td colspan="2"><font face="verdana" size="2" color="#8C8E91"><b>What plan would you like to sign up for?</b><br><i>You can always upgrade later</i></td>
																		</tr>
																		<tr>
																			<td colspan="2">&nbsp;</td>
																		</tr>
																	<?
																		
																		if($p == ""){
																			$p = 1;
																		}
																		$plan_result = mysql_query("SELECT * FROM plans order by 'display_order'");
																		while($plan = mysql_fetch_object($plan_result)){
																	?>															
																		<tr>															
																			<td><input type="radio" name="plan" value="<?php echo $plan->plan_id; ?>" <?php if($p == $plan->plan_id){ echo "checked"; }?>></td>																		
																			<td><font face="Verdana" style="font-size: 11;" color="#083C58"><b><?php echo $plan->name; ?></td>																
																		</tr>
																		
																		<tr>																	
																			<td></td>																		
																			<td><font face="Verdana" style="font-size: 11;" color="#083C58"><?php if($plan->space == "99999"){ echo "Unlimited"; } else { echo $plan->space . "mb";} ?> Disk Space, <?php if($plan->bandwidth == "99999"){ echo "Unlimited "; } else { echo $plan->bandwidth . "mb/month"; } ?> bandwidth, $<?php echo $plan->price; ?>/month [<a href="#" onclick="window.open('plans.php?p=<? echo $plan->plan_id; ?>', 'image_win', ['HEIGHT=200', 'WIDTH=400', 'dependent']);">more info</a>]</td>																	
																		</tr>
																		<? if($plan->price3 != "" or $plan->price6 != "" or $plan->price12 != ""){?>
																		<tr>																	
																			<td></td>																		
																			<td><input type="radio" name="months" value="1"><font face="Verdana" style="font-size: 11;" color="#083C58"> $<? echo $plan->price; ?> For 1 Month</td>																	
																		</tr>
																		<? }?>
																		<? if($plan->price3 != ""){?>
																		<tr>																	
																			<td></td>																		
																			<td><input type="radio" name="months" value="3"><font face="Verdana" style="font-size: 11;" color="#083C58"> $<? echo $plan->price3; ?> For 3 Months</td>																	
																		</tr>
																		<? } ?>
																		<? if($plan->price6 != ""){?>
																		<tr>																	
																			<td></td>																		
																			<td><input type="radio" name="months" value="6"><font face="Verdana" style="font-size: 11;" color="#083C58"> $<? echo $plan->price6; ?> For 6 Months</td>																	
																		</tr>
																		<? }?>
																		<? if($plan->price12 != ""){?>
																		<tr>																	
																			<td></td>																		
																			<td><input type="radio" name="months" value="12"><font face="Verdana" style="font-size: 11;" color="#083C58"> $<? echo $plan->price12; ?> For 12 Months</td>																	
																		</tr>
																		<? }?>														
																	<?
																		}
																	}
																	?>
																	<tr>
																		<td colspan="2">&nbsp;</td>
																	</tr>														
																</table>															
															</td>															
														</tr>
														<tr>
															<td colspan="2" align="right"><a name="submit"><a href="#submit"><img src="./images/ButtonSignupForm.gif" border="0" onclick="js_signup();"></td>
														</tr>														
													</table>
												</td>
											</tr>
											<tr>
												<td>&nbsp;</td>
											</tr>
											</form>
										<?
											break;
											case "paypal":
										?>
											<tr>
												<td style="border: 1px solid #083C58; padding: 10px" bgcolor="#F8F8F8">
													<table width="100%">
														<!--													
														<tr>	
															<td><font face="Verdana" style="font-size: 11;" color="#083C58">your member id is <? echo $mid; ?><br>your member key is <? echo $key; ?></td>
														</tr>
														-->
														<tr>	
															<td><font face="Verdana" style="font-size: 11;" color="#083C58">Thank you for taking the time to sign up. Click on the "Complete Sign Up" button below to complete the signup process. After your payment information is entered on PayPal click the <b>Access Subscription</b> button to return to <? echo $setup->title; ?> where your account will be activated and you can start hosting your images.</td>
														</tr>
														<tr>
															<td>&nbsp;</td>
														</tr>
														<?
														if($months == ""){
															$months = 1;
														}
														
														if($oid != ""){
															$plan_result = mysql_query("SELECT * FROM offers WHERE offer_id = '$oid'");
															$plan = mysql_fetch_object($plan_result);
														}
														else {
															// Plan
															$plan_result = mysql_query("SELECT * FROM plans WHERE plan_id = '$pid'");
															$plan = mysql_fetch_object($plan_result);
														}
														
														if($months == "1"){
															$price = $plan->price;
														}
														if($months == "3"){
															$price = $plan->price3;
														}
														if($months == "6"){
															$price = $plan->price6;
														}
														if($months == "12"){
															$price = $plan->price12;
														}
														
														?>
														
														<tr>
															<td align="right">
															<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
															<input type="hidden" name="cmd" value="_xclick-subscriptions">
															<input type="hidden" name="business" value="<? echo $setup->paypal_email; ?>">
															<input type="hidden" name="item_name" value="<? echo $setup->title; ?> Monthly Image Hosting">
															<input type="hidden" name="item_number" value="<? echo $amid; ?>">
															<input type="hidden" name="no_shipping" value="1">
															<input type="hidden" name="return" value="<? echo $setup->url; ?>/actions.php?pmode=activate&amid=<? echo $amid; ?>">
															<input type="hidden" name="cancel_return" value="<? echo $setup->url; ?>">
															<input type="hidden" name="no_note" value="1">
															<input type="hidden" name="notify_url" value="<? echo $setup->url; ?>/paypal_ipn.php">
															<input type="hidden" name="currency_code" value="USD">
															<input type="image" src="images/ButtonSignupForm2.gif" border="0" name="submit" alt="Pay with Paypal">
															<input type="hidden" name="a3" value="<? echo $price; ?>">
															<input type="hidden" name="p3" value="<? echo $months; ?>">
															<input type="hidden" name="t3" value="M">
															<input type="hidden" name="src" value="1">
															<input type="hidden" name="sra" value="1">
															</form>												
															</td>
														</tr>
													</table>
												</td>
											</tr>
										
										<?	
											break;
											case "confirm":
											
											break;
										}
										?>
										</table>
										
										<!--
										**************************
										**** END BODY CONTENT ****
										**************************
										-->
									</td>
								</tr>
							</table>
							<!--
							**************************
							***** END BODY TABLE *****
							**************************
							-->
						</td>
						<td valign="top"bgcolor="#295670"><img src="./images/IndexDropShadow.gif"></td>
						<td valign="top" bgcolor="#083C58">
							<?php
								if($access == "true"){
									include("i.member.rn.php");
								}
								else{
									include("i.rn.plans.php");
								}	
							?>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td background="./images/Footer.gif"><img src="./images/Footer.gif" border="0"></td>
		</tr>
		<tr>
			<td>
				<?php include("i.footer.php"); ?>
			</td>
		</tr>
	</table>

<?
mysql_close($db);
print($close);
?>