ob_start(); require_once("header.php"); ?>
| Forgot Password | ||||||||||||||||
$msg="";
/************************************************************************************************************* */
$stremail=""; //
$recresult=""; //
$obj_row="";//
$str_body="";//
if(!empty($_REQUEST['msg'])) $msg = $_REQUEST['msg'];
/************************************************************************************************************** */
/*echo "";
print_r($_REQUEST);*/
if( (isset($_POST['forgot_pss_x']) || isset($_POST['forgot_pss'])))
{
$email=$_POST['txtemail'];
$email = stripslashes($email);
$email = mysql_real_escape_string($email);
$r = $db->select("SELECT * FROM user_master where email='$email' and user_status = 1 ");
$count = sizeof($r);
if($count > 0)
{
$row = $r;
$password=$row[0]["password"];
$email=$row[0]["email"];
$newPass = str_rand(8, 'alphanum');
$new_md_pass = md5($newPass);
$update_user_array = array('password' => $new_md_pass);
//print_r($update_user_array);
//$data = array('date_added' => time());
$rows = $db->update_array('user_master', $update_user_array, "email='$email'");
if (!$rows) $db->print_last_error(false);
if ($rows > 0) { //echo "$rows rows updated.";
}
$str_headers ="";//
$str_body="
"; $str_headers = "From: anatoliaturkishgrill@anatoliaturkishgrill.com \r\n"; $str_headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; @mail($email, "Anatolia - Forgot Password ", $str_body, $str_headers); /*Send Email Alert*/ if ($_SERVER["SERVER_NAME"]=="developer4" || $_SERVER["SERVER_NAME"]=="localhost" || $_SERVER["SERVER_NAME"]=="90.0.0.15" ) {$msg = "Details have been mailed to your email Address. Your new Password = $newPass"; } else {$msg = "Details have been mailed to your email Address."; } //header("location: forgot_password.php?msg=".htmlentities(urlencode($msg))); $msr_new= htmlentities(urlencode($msg)); ?> //echo "your new Password = $newPass"; }else {$msg ="Invalid Email Address"; } } ?> |
||||||||||||||||