<?php
///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//   Program Name         : ProPhotoHost                                     //
//   Release Version      : 1.0                                              //
//   Home Page            : http://www.prophotohost.com                      //
//   Program Author       : Jake P                                           //
//   Supplied by          : drew010                                          //
//   Nullified by         : CyKuH [WTN]                                      //
//   Distribution         : via WebForum, ForumRU and associated file dumps  //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////
session_start();
session_register("signup_name");
session_register("signup_email");
session_register("signup_newsletter");
session_register("signup_member_key");

include('i.setup.php');
include('i.connection.php');
include('i.function.php');

if($mode == "signup") {
	
	$signup_name = $member_name;
	$signup_reminder = $member_reminder;
	$signup_newsletter = $member_newsletter;
	
	$before = $member_email;
	$member_email = strtoupper($member_email);
	
	$result = mysql_query("SELECT member_email FROM member WHERE member_status = 'A' AND member_email = '$member_email'", $db);
	$rows = mysql_num_rows($result);
	
	if($rows > 0) {
		header("location: " . $PHP_SELF . "?error=email&member_email=" . $before);
		exit;
	}
	
	$member_password = MD5($member_password);
	$member_key = random(32, "");
	
	if($member_newsletter == 1) {
		$member_newsletter = "Y";
	}
	else {
		$member_newsletter = "N";
	}
	
	$date = now();
	
	$sql = "INSERT INTO member (member_email, member_name, member_password, member_newsletter, member_key, member_status, created_on, updated_on) VALUES ('$member_email', '$member_name', '$member_password', '$member_newsletter', '$member_key', 'I', '$date', '$date')";
	$run = mysql_query($sql);
	
	$signup_member_key = $member_key;
	
	session_unregister("signup_name");
	session_unregister("signup_newsletter");
	
	// use for instant free activation
	//header("location: ./verify.php?member_key=" . $member_key);
	// use for paypal activation
	header("location: ./confirmation.php?confirm=gotopaypal");
	
}
?>

<html>

<head>
<title><?php print($page_title); ?></title>

<meta name="description" content="<?php print($page_desc); ?>">
<meta name="keywords" content="<?php print($page_key); ?>">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

<?php include('i.style.php'); ?>

<script language="javascript">
	
	function js_signup() {
		if(document.signup.member_name.value == "") {
			alert("Please enter a member name.");
			return false;
		}
		if(document.signup.member_email.value == "") {
			alert("Please enter your e-mail address.");
			return false;
		}
		if(document.signup.member_password.value == "") {
			alert("Please enter a password.");
			return false;
		}
		if(document.signup.member_confirm_password.value == "") {
			alert("Please confirm your password.");
			return false;
		}
		if(document.signup.member_password.value != document.signup.member_confirm_password.value) {
			alert("Your passwords do not match.");
			return false;
		}
	}
	
</script>

</head>

<body <?php if($session_access == false) { ?>onload="document.login.email.focus();"<?php } ?> marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0">
	
	<table width="100%" cellpadding="0" cellspacing="0">
		
		<?php include('i.header.php'); ?>
		
		<tr>
			
			<td valign="top">
				
				<table cellpadding="0" cellspacing="0">
					
					<tr>
						
						<td><font face="verdana" size="1">&nbsp;&nbsp;&nbsp;</font></td>
						
					</tr>
					
				<tr>
					
					<td><font face="verdana" size="1">&nbsp;&nbsp;&nbsp;</font></td>
					
					<td valign="top">
						
						<table cellpadding="0" cellspacing="0">
							
							<?php include('i.tab.php'); ?>
							
						</table>
						
					</td>
					
					<td><font face="verdana" size="1">&nbsp;&nbsp;</font></td>
					
					<td valign="top" width="100%">
						
						<table width="100%" cellpadding="0" cellspacing="0">
							
							<tr>
								
								<td><font face="verdana" size="1">&nbsp;</font></td>
								
								<td width="100%">
									
									<table width="100%" cellpadding="0" cellspacing="0">
										
										<tr>
											
											<td><img src="./images/heading.signup.gif"></td>
											
										</tr>
										
										<tr>
											
											<td height="8" background="images/hr.gif"></td>
											
										</tr>
										
										<tr>
											
											<td><font face="verdana" size="1">&nbsp;</font></td>
											
										</tr>
										
										<form name="signup" method="post" onsubmit="return js_signup();" action="<?php print($PHP_SELF); ?>?mode=signup">
										
										<tr>
											
											<td>
												
												<table>
													
													<tr>
														
														<td>&nbsp;</td>
														<td><font face="verdana" size="1">Membership is only $<?php print($service_pricing); ?> per month!</font></td>
														
													</tr>
													
													<tr>
														
														<td><font face="verdana" size="1">Name: </font></td>
														<td><input type="text" name="member_name" class="form" style="width: 300px;" value="<?php if($error == "email") { print($signup_name); } ?>"></td>
														
													</tr>
													
													<?php if($error == "email") { ?>
													
													<tr>
														
														<td>&nbsp;</td>
														<td><font face="verdana" size="1">Please choose another e-mail address, <?php print($member_email); ?> is taken.</font></td>
														
													</tr>
													
													<?php } ?>
													
													<tr>
														
														<td><font face="verdana" size="1">E-mail: </font></td>
														<td><input type="text" name="member_email" class="form" style="width: 300px;"></td>
														
													</tr>
													
													<tr>
														
														<td><font face="verdana" size="1">Password: </font></td>
														<td><input type="password" name="member_password" class="form" style="width: 300px;"></td>
														
													</tr>
													
													<tr>
														
														<td><font face="verdana" size="1">Confirm Password: </font></td>
														<td><input type="password" name="member_confirm_password" class="form" style="width: 300px;"></td>
														
													</tr>
													
													<tr>
														
														<td><font face="verdana" size="1">Newsletter: </font></td>
														<td><input type="checkbox" name="member_newsletter" class="form" value="1" <?php if($error == "email") { if($signup_newsletter == 1) { ?>checked<?php } } ?>></td>
														
													</tr>
													
													<tr>
														
														<td>&nbsp;</td>
														<td align="right"><input type="image" src="./images/bu.signup.gif" name="signup_button"></td>
														
													</tr>
													
												</table>
												
											</td>
											
										</tr>
										
										</form>
										
										<tr>
											
											<td><img src="./images/heading.services.gif"></td>
											
										</tr>
										
										<tr>
											
											<td height="8" background="images/hr.gif"></td>
											
										</tr>
										
										<tr>
											
											<td><font face="verdana" size="1">&nbsp;</font></td>
											
										</tr>
										
										<tr>
											
											<td>
												
												<font face="verdana" size="2">
													
													<img src="./images/star.gif">&nbsp;Unlimited Image Hosting!<br>
													<img src="./images/star.gif">&nbsp;No Limitations!<br>
													<img src="./images/star.gif">&nbsp;Reliable Hosting!<br>
													<img src="./images/star.gif">&nbsp;99.5% Server Up Time!<br>
													<img src="./images/star.gif">&nbsp;Only $<?php print($service_pricing); ?> Per Month!<br>
													
												</font>
												
											</td>
											
										</tr>
										
										<tr>
											
											<td><font face="verdana" size="1">&nbsp;</font></td>
											
										</tr>
										
										<tr>
											
											<td height="8" background="images/hr.gif"></td>
											
										</tr>
										
									</table>
									
								</td>
								
								<td><font face="verdana" size="1">&nbsp;</font></td>
								
							</tr>
							
						</table>
						
					</td>
					
				</tr>
				
			</table>
			
		</td>
		
	</tr>
	
	<?php include('i.footer.php'); ?>
	
	</table>
	
</body>

</html>