include("admin/classes/initial.php");
include("admin/classes/config.php");
include("admin/classes/functions.php");
if ($_REQUEST['action']=="resetpassword") {
$error=0;
$Email = strtolower(trim($_POST['Email']));
$captcha = trim($_POST['captcha']);
if ($Email=="") {
$error_string .= "Enter your valid email address
";
$error=1;
}
if ($captcha=="") {
$error_string .= "Enter captcha code
";
$error=1;
}
if($_POST['captcha'] != $_SESSION['digit']) {
$error_string .= "Sorry, captcha validation failed.
";
$error=1;
}
$chkrsq = mysqli_query($con,"select MemberId, Email, FirstName, LastName from members where Email='".mysqli_real_escape_string($con,$Email)."'");
if (mysqli_num_rows($chkrsq)==0) {
$error_string .= "Sorry, this email is not registered with us.
";
$error=1;
}else {
$chkrs = mysqli_fetch_assoc($chkrsq);
$MemberId = $chkrs['MemberId'];
$Email = $chkrs['Email'];
$FirstName = $chkrs['FirstName'];
$LastName = $chkrs['LastName'];
if ($MemberId=="") {
$error_string .= "Sorry, we could not track your membership.
";
$error=1;
}
}
if ($error==1) {
$error = '{"status":"validation_failed", "message":"'.$error_string.'"}';
die($error);
}else {
$token = generateRandomString(50);
$url = USERPATH . "reset-password-action?token=" . $token;
$sql = "insert into passwordtokens set MemberId='".$MemberId."', Token='".$token."', CreatedOn='".gmdate("Y-m-d H:i:s")."', isUsed='0'";
$template = '
|
|
|
Reset your password