/* +----------------------------------------------------------------------+ | BCSE Customer Password Recovery Mod | +----------------------------------------------------------------------+ | Copyright (c) 2004-2009 BCSE LLC. dba BCS Engineering | +----------------------------------------------------------------------+ | | | BCSE Customer Password Recovery Mod is subject for version 2.0 of | | the BCSE proprietary license. That license file can be found bundled | | with this package in the file BCSE_LICENSE. A copy of this license | | can also be found at | | http://www.bcsengineering.com/license/BCSE_LICENSE_2.0.txt | | | +----------------------------------------------------------------------+ */ require "./auth.php"; x_load("mail"); if ($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; if ($active_modules["Bestsellers"]) include $xcart_dir."/modules/Bestsellers/bestsellers.php"; if (!empty($active_modules["Special_Offers"])) include $xcart_dir."/modules/Special_Offers/category_offers.php"; $valid_email = false; if(isset($_POST['in'])){ $email = $_POST['in']; $email = trim($email); if(preg_match('/^[A-Z0-9_-][A-Z0-9._-]*@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,6}$/i', $email)){ $valid_email = true; } } if($valid_email){ $account = func_query(" SELECT login, password, usertype FROM $sql_tbl[customers] WHERE email='".addslashes($email)."' AND status='Y' AND usertype='C'"); } if($account == NULL && $valid_email){ $top_message = array("type" => "E"); $top_message['content'] = func_get_langvar_by_name("lbl_send_mail_error"); $smarty->assign("top_message",$top_message); $top_message = ""; }elseif($account != NULL && $valid_email){ for($i=0;$iassign("account",$account); func_send_mail($email, "mail/password_recover_subj.tpl", "mail/customer_password_recover.tpl" , $config["Company"]["support_department"], false); $top_message = array("type" => "I"); $top_message['content'] = func_get_langvar_by_name("lbl_send_mail_success"); $smarty->assign("top_message",$top_message); $top_message = ""; }elseif($account != NULL && !$valid_email){ $top_message = array("type" => "E"); $top_message['content'] = func_get_langvar_by_name("lbl_send_mail_error"); $smarty->assign("top_message",$top_message); $top_message = ""; } $smarty->assign("main","BCSE_pw_recover"); func_display("customer/home.tpl",$smarty); ?>