<?php
ini_set('session.cookie_domain', '.wowdoyou.com');
session_start();
include("includes/site_info.php");

$confirm = false;
if(isset($_GET['id']) && isset($_GET['email'])){
$reg_confirm_id=$_GET['id'];
$email=urldecode($_GET['email']);

$query="SELECT mem_userid FROM password_reset WHERE mem_email = '$email' and mem_confirm ='".md5($reg_confirm_id)."'";
$result=mysql_query($query,$link) or die(mysql_error());
$retval=mysql_num_rows($result);

if ($retval < 1) {
	$confirm = false;
	$error = "Invalid Link <br>The link that you followed was invalid or incomplete. Try copying and pasting the full link into the address bar. Alternatively, try sending another request below.";
} else {
	$confirm = true;
}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="noodp,noydir" />
<meta name="description" content="Wauhaha web is a social interaction media that gives people power to create demand and get value while connected with the world." />
<link rel="alternate" media="handheld" href="http://www.wowdoyou.com/" />
<title>Reset Password | Wauhaha</title>
<link rel="stylesheet" type="text/css" href="main.css">
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="top">
				<tr>
					<td><table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" class="bottom">
							<tr>
								<td><table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" class="header">
										<tr>
											<td width="353" valign="top"><a href="http://www.wowdoyou.com"> <img src="images/logo.gif" alt="wauhaha" border="0" > </a></td>
											<td width="647" valign="top"><div id="menu-float-main"><span class="lang_button">English</span></div>
												<div style="float:right; padding-top:135px;"><span class="logout_button">Beta Versions</span></div></td>
										</tr>
									</table>
									<div class="middle-float">
										<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
											<tr>
												<td width="666" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
														<tr>
															<td valign="top" class="link_top_t"><img src="images/home.gif" alt="home" width="23" height="21" hspace="0" vspace="0" border="0"> <a href="index.php" target="_self">Home</a> </td>
														</tr>
														<tr>
															<td><img src="images/spacer.gif" width="1" height="40"></td>
														</tr>
														<tr>
															<td align="left"><table width="600" border="0" cellpadding="0" cellspacing="0">
																	<tr>
																		<td width="12" valign="bottom"><img src="images/big-box_01.jpg" width="12" height="12"></td>
																		<td width="642" valign="bottom" style="background-image:url(images/big-box_02.jpg); background-repeat:repeat-x; background-position:bottom">&nbsp;</td>
																		<td width="12" valign="bottom"><img src="images/big-box_04.jpg" width="12" height="12"></td>
																	</tr>
																	<tr>
																		<td style="background-image:url(images/big-box_05.jpg); background-repeat:repeat-y">&nbsp;</td>
																		<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
																				<tr>
																					<td><div id="loading"><img src="images/spacer.gif"></div></td>
																				</tr>
																				<tr>
																					<td><?php if ($confirm==true) { ?>
																						<script type="text/javascript">
jQuery(document).ready(function(){
    jQuery("#FrmNewPass").submit(function(){

	if (jQuery("#npass").val() == "")
    {
      alert("Invalid Password!");
      jQuery("#npass").focus();
      return false;
    }

   if ((jQuery("#npass").val().length < 6) || (jQuery("#npass").val().length > 20))
   {
     alert("Password limit between 6-20 characters.");
     jQuery("#npass").focus();
      return false;
   }

	if (jQuery("#cpass").val() == "")
    {
      alert("Invalid Confirm Password!");
      jQuery("#cpass").focus();
      return false;
    }

   if ((jQuery("#cpass").val().length < 6) || (jQuery("#cpass").val().length > 20))
   {
     alert("Confirm Password limit between 6-20 characters.");
     jQuery("#cpass").focus();
      return false;
   }

   if (jQuery("#npass").val() != jQuery("#cpass").val())
    {
      alert("Password not match - please re-enter.");
      jQuery("#cpass").focus();
      return false;
   }

	var str = 'Submit=FrmNewPass&' + jQuery(this).serialize();
	jQuery('#loading').show();
   		jQuery.ajax({
   		type: "POST",
   		url: "resetAction.php",
   		data: str,
		dataType: 'json',
   		success: function(result){
		//alert (result);
		jQuery('#loading').hide();
		if (result.error) {
 		jQuery("#msg_content_error").fadeIn('slow');
		if (jQuery.isArray(result.error)==true){
 				jQuery('#msg_content_error').html('');
				jQuery.each(result.error, function(key, value) { 
					jQuery('#msg_content_error').append(value+'<br>');
				});
		} else {
 				jQuery('#msg_content_error').html(result.error);
		}
		} else {
		//alert (result.message);
 		window.location.href='<?=$CONST_LINK_ROOT?>/complete_login.php?RUsername='+result.username+'&RPassword='+result.password;
		}
		}

 });
return false;
    });
});
   </script>
																						<div id="main_content">
																							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="white_back_t">
																								<tr>
																									<td width="100%" class="purple_back">ENTER NEW PASSWORD </td>
																								</tr>
																								<tr>
																									<td><table width="100%" border="0" align="" cellpadding="5" cellspacing="0" class="white_back_t_xb">
																											<tr>
																												<td align="center"><?php if (!empty($error)) { ?>
																													<div id="msg_content_error">
																														<?=$error?>
																													</div>
																													<?php } else { ?>
																													<div id="msg_content_error" style="display:none;"></div>
																													<?php } ?>
																												</td>
																											</tr>
																											<tr>
																												<td width="100%" align="center"><form action="<?=$_SERVER['PHP_SELF'];?>" method="post" name="FrmNewPass" id="FrmNewPass" style="margin:0px; padding:0px">
																														<table border="0" cellspacing="0" cellpadding="5" class="white_back_t">
																															<tr>
																																<td>Email Address:</td>
																																<td><?=$email?>
																																	<input name="resetMail" type="hidden" value="<?=$email?>">
																																	<input name="reg_confirm_id" type="hidden" value="<?=$reg_confirm_id?>"></td>
																															</tr>
																															<tr>
																																<td>*New Password:</td>
																																<td><input name="npass" type="password" id="npass" size="30" maxlength="20"></td>
																															</tr>
																															<tr>
																																<td>*Confirm Password:</td>
																																<td><input name="cpass" type="password" id="cpass" size="30" maxlength="20"></td>
																															</tr>
																															<tr>
																																<td colspan="2" align="center"><input type="submit" name="Submit" value="Submit"></td>
																															</tr>
																														</table>
																													</form></td>
																											</tr>
																											<tr>
																												<td>&nbsp;</td>
																											</tr>
																										</table></td>
																								</tr>
																							</table>
																						</div>
																						<?php } else { ?>
																						<script type="text/javascript">
jQuery(document).ready(function(){
    jQuery("#FrmReset").submit(function(){

	if (jQuery("#vcode").val() == "")
    {
      alert("Invalid Verification Code!");
      jQuery("#vcode").focus();
      return false;
    }

	if ((jQuery("#resetMail").val() == "") || (jQuery("#resetMail").val().length < 5))
    {
      alert("Invalid Email!");
      jQuery("#resetMail").focus();
      return false;
    }

/*   if (jQuery("#resetMail").val().indexOf("@") < 0 || jQuery("#resetMail").val().indexOf(".") < 0)
   {
      alert("Invalid Email!");
      jQuery("#resetMail").focus();
      return false;
   }
*/	var str = 'Submit=FrmReset&' + jQuery(this).serialize();
	jQuery('#loading').show();
   		jQuery.ajax({
   		type: "POST",
   		url: "resetAction.php",
   		data: str,
		dataType: 'json',
   		success: function(result){
		//alert (result);
		jQuery('#loading').hide();
		if (result.error) {
 		jQuery("#msg_content_error").fadeIn('slow');
		if (jQuery.isArray(result.error)==true){
 				jQuery('#msg_content_error').html('');
				jQuery.each(result.error, function(key, value) { 
					jQuery('#msg_content_error').append(value+'<br>');
				});
		} else {
 				jQuery('#msg_content_error').html(result.error);
		}
		d = new Date().getTime();
		jQuery('#verImage').attr("src", "verImage.php?"+d);
		//jQuery('#verImage').html('<img src="verImage.php" align="absbottom" class="border-1px"/>&nbsp;<input name="vcode" type="text" id="vcode" value="" maxlength="5"/>');
      jQuery("#vcode").val("");
      jQuery("#vcode").focus();
		} else {
		//alert (result.message);
      	jQuery("#vcode").val("");
 		jQuery('#main_content').hide();
 		jQuery('#main_done').fadeIn('slow');
		}
		}

 });
return false;
    });
});
   </script>
																						<div id="main_content">
																							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="white_back_t">
																								<tr>
																									<td width="100%" class="purple_back">RESET PASSWORD </td>
																								</tr>
																								<tr>
																									<td><table width="100%" border="0" align="" cellpadding="5" cellspacing="0" class="white_back_t_xb">
																											<tr>
																												<td align="center"><?php if (!empty($error)) { ?>
																													<div id="msg_content_error">
																														<?=$error?>
																													</div>
																													<?php } else { ?>
																													<div id="msg_content_error" style="display:none;"></div>
																													<?php } ?>
																													If you forgot your password, enter your username or email address and fill the security check. An email with reset link will be sent to the email adddress that you registered with. </td>
																											</tr>
																											<tr>
																												<td width="100%" align="center"><form action="<?=$_SERVER['PHP_SELF'];?>" method="post" name="FrmReset" id="FrmReset" style="margin:0px; padding:0px">
																														<table border="0" cellspacing="0" cellpadding="5" class="white_back_t">
																															<tr>
																																<td>Verification&nbsp;Code:</td>
																																<td><img src="verImage.php" align="absbottom" class="border-1px" id="verImage"/>
																																	<input name="vcode" type="text" id="vcode" value="" maxlength="5"/>
																																</td>
																															</tr>
																															<tr>
																																<td>Username/Email Address:</td>
																																<td><input name="resetMail" type="text" id="resetMail" size="30" maxlength="200" value="<?=$_REQUEST["resetMail"]?>"></td>
																															</tr>
																															<tr>
																																<td colspan="2" align="center"><input type="submit" name="Submit" value="Submit"></td>
																															</tr>
																														</table>
																													</form></td>
																											</tr>
																											<tr>
																												<td>&nbsp;</td>
																											</tr>
																										</table></td>
																								</tr>
																							</table>
																						</div>
																						<div id="main_done" style="display:none;">
																							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="white_back_t">
																								<tr>
																									<td width="100%" class="purple_back">PLEASE CHECK YOUR EMAIL </td>
																								</tr>
																								<tr>
																									<td><table width="100%" border="0" align="" cellpadding="5" cellspacing="0" class="white_back_t_xb">
																											<tr>
																												<td align="center"><p>Your Password Reset Link have been sent to the e-mail address that you registered with and should arrive within a few minutes.</p>
																													<p>If you do not receive the email then please contact us by e-mail at <a href="mailto:support@wauhaha.com">support@wauhaha.com</a> giving as much detail as possible to help us locate your record.</p></td>
																											</tr>
																										</table></td>
																								</tr>
																							</table>
																						</div>
																						<?php } ?>
																					</td>
																				</tr>
																			</table></td>
																		<td style="background-image:url(images/big-box_07.jpg); background-repeat:repeat-y">&nbsp;</td>
																	</tr>
																	<tr>
																		<td valign="top"><img src="images/big-box_10.jpg" width="12" height="12"></td>
																		<td valign="top" style="background-image:url(images/big-box_11.jpg); background-repeat:repeat-x; background-position:top">&nbsp;</td>
																		<td valign="top"><img src="images/big-box_12.jpg" width="12" height="12"></td>
																	</tr>
																</table></td>
														</tr>
													</table></td>
												<td width="374" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
														<tr>
															<td><img src="images/spacer.gif" width="30" height="1"></td>
															<td><?php include ("login_box.php"); ?></td>
														</tr>
													</table></td>
											</tr>
										</table>
									</div></td>
							</tr>
							<tr>
								<td align="center"><table border="0" cellpadding="10" cellspacing="0" class="menu_bottom_t">
										<tr>
												<td><a href="wauhhBiz.php" target="_self" title="WAUHHBIZ">WAUHHBIZ</a></td>
												<td><a href="http://marketer.wauhaha.com/wauhhHot.php" target="_self" title="WAUHHHOT">WAUHHHOT</a></td>
											<td><a href="http://socializer.wauhaha.com/wauhhSoc.php" target="_self" title="WAUHHSOCIETY">WAUHHSOCIETY</a></td>
											<td><a href="index.php" target="_self">HOME</a></td>
											<td><a href="about.php" target="_self">ABOUT</a></td>
											<td><a href="contactus.html" target="_self">CONTACT</a></td>
											<td><a href="career.php" target="_self">CAREERS</a></td>
											<td><a href="terms.html" target="_self">TERMS</a></td>
											<td><a href="privacy.html" target="_self">PRIVACY</a></td>
												<td><a href="invmsg.php" title="Investor Message" target="_self">INVESTOR</a></td>
												<td><a href="http://www.facebook.com/pages/Wauhaha/125760707473366" target="_blank" title="Facebook Page">FB PAGE</a></td>
											</tr>
									</table></td>
							</tr>
						</table></td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td><table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="copyright">
				<tr>
					<td align="center">Copyright &copy; 2011 Wauhaha.com. All Rights Reserved. Reproduction strictly prohibited.<br>
						4All brand names and products are registered trademarks and patent pending of their respective companies.</td>
				</tr>
			</table></td>
	</tr>
</table>
</body>
</html>
