assign('forgot_password', "YES"); } $errors = 0; $error = array(); if(!valid_email($email)) { $errors++; $error[] = $lang['49']; } if ($errors == 0) { $crypt_password = md5($password); $sql = "SELECT customer_email FROM diffshop_customers WHERE customer_email = '$email' ORDER BY customer_id ASC"; $result= mysql_query($sql); if(mysql_num_rows($result) == 1) { $user_exist = "YES"; } else { $user_exist = "NO"; } } if ($user_exist == "NO") { $errors++; $error[] = $lang['85']; } $smarty->assign('errors', $errors); if ($errors > 0) { $error = array_unique($error); foreach ($error as $key => $value) { $forgot_errors .= $value."
"; } $smarty->assign('forgot_errors', $forgot_errors); } if ($errors == 0) { $unique = uniqid(1234567890); $password = substr("$unique", 10); $password1 = md5($password); $query = "UPDATE diffshop_customers SET customer_password = '$password1' WHERE customer_email = '$email'"; $result = mysql_query($query) or die("error in query - $query - ".mysql_error()); $smarty->assign('password1', $password); //////// get email message $query = "SELECT shop_name, shop_email, ".select_language('shop_email_subject_lang1', 'shop_email_subject_lang2', 'shop_email_subject_lang3', 'shop_email_subject_lang4', 'shop_email_subject_lang5', 'shop_email_subject_lang6').", ".select_language('shop_email_description_lang1', 'shop_email_description_lang2', 'shop_email_description_lang3', 'shop_email_description_lang4', 'shop_email_description_lang5', 'shop_email_description_lang6')." FROM diffshop_general_settings_forgotpass_email WHERE id='1'"; $result = mysql_query($query) or die("error in query - $query - ".mysql_error()); while($row = mysql_fetch_array($result)) { $shop_name = $row[0]; $shop_email = $row[1]; $shop_email_subject = magic_quotes_strip($row[2]); $shop_email_description = magic_quotes_strip($row[3]); } $shop_email_description = str_replace('%new_password%', $password, $shop_email_description); ///////// convert message //////////// $filename = "templates-email/template_email_forgot_password.html"; $fd = fopen($filename, "r"); $html_receipt_template = fread($fd, filesize($filename)); fclose($fd); $html_receipt_template = str_replace('-=CONTENT=-', $shop_email_description, $html_receipt_template); $mail_header = "From: $shop_email\n"; $mail_header .= "Reply-to: $shop_email\n"; $mail_header .= "Content-Type: text/html\n"; mail($email, $shop_email_subject, $html_receipt_template, $mail_header); } //////////////////////////////////////////////////////////////////////////////////////////////////////*\ $smarty->display('forgot_password.tpl'); include ("close_mysql.php"); ?>