Code:
# $Id: help.php,v 1.33.2.1 2004/02/05 12:25:46 mclap Exp $
#
if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); }
if (!empty($login))
$userinfo = func_userinfo($login,$login_type);
if (empty($section)) $section = "";
if ($REQUEST_METHOD=="POST" and $action=="contactus") {
#
# Send mail to support
#
$HTTP_POST_VARS["body"] = stripslashes($HTTP_POST_VARS["body"]);
while (list($key,$val) = each($HTTP_POST_VARS))
$contact[$key]=$val;
$fillerror = (empty($contact["firstname"]) || empty($contact["lastname"]) || empty($contact["b_address"]) || empty($contact["b_city"]) || empty($contact["b_country"]) || empty($contact["b_zipcode"]) || empty($contact["phone"]) || empty($contact["email"]) || empty($contact["subject"]) || empty($contact["body"]));
if(!$fillerror) {
$contact["b_statename"]= func_get_state($contact["b_state"], $contact["b_country"]);
$contact["b_countryname"]= func_get_country($contact["b_country"]);
$mail_smarty->assign("contact",$contact);
func_send_mail($config["Company"]["support_department"], "mail/help_contactus_subj.tpl", "mail/help_contactus.tpl", $contact["email"], true);
func_header_location("help.php?section=contactus");
} else {
$userinfo = $HTTP_POST_VARS;
$userinfo["login"] = $userinfo["uname"];
}
}
if ($REQUEST_METHOD=="POST" and $action=="become") {
#
# become a reseller
#
$HTTP_POST_VARS["body"] = stripslashes($HTTP_POST_VARS["body"]);
while (list($key,$val) = each($HTTP_POST_VARS))
$contact[$key]=$val;
$fillerror = (empty($contact["firstname"]) || empty($contact["lastname"]) || empty($contact["b_address"]) || empty($contact["b_city"]) || empty($contact["b_country"]) || empty($contact["b_zipcode"]) || empty($contact["phone"]) || empty($contact["email"]) || empty($contact["subject"]) || empty($contact["body"]));
if(!$fillerror) {
$contact["b_statename"]= func_get_state($contact["b_state"], $contact["b_country"]);
$contact["b_countryname"]= func_get_country($contact["b_country"]);
$mail_smarty->assign("contact",$contact);
func_send_mail($config["Company"]["support_department"], "mail/help_contactus_subj.tpl", "mail/help_contactus.tpl", $contact["email"], true);
func_header_location("help.php?section=become_a_reseller");
} else {
$userinfo = $HTTP_POST_VARS;
$userinfo["login"] = $userinfo["uname"];
}
}
#
# Recover password
#
if ($REQUEST_METHOD=="POST" and $action=="recover_password") {
$accounts = func_query("select login, password, usertype from $sql_tbl[customers] where email='$email' and status='Y'");
#
# Decrypt passwords
#
if($accounts) {
foreach($accounts as $key=>$account)
$accounts[$key]["password"]=text_decrypt($accounts[$key]["password"]);
$mail_smarty->assign("accounts",$accounts);
func_send_mail($email, "mail/password_recover_subj.tpl", "mail/password_recover.tpl", $config["Company"]["support_department"], false);
func_header_location("help.php?section=Password_Recovery_message&email=".urlencode($email));
}
else
func_header_location("help.php?section=Password_Recovery_error&email=".urlencode($email));
}
if ($section=="contactus" ) {
include $xcart_dir."/include/states.php";
include $xcart_dir."/include/countries.php";
}
if ($section=="become") {
include $xcart_dir."/include/states.php";
include $xcart_dir."/include/countries.php";
}
$smarty->assign("userinfo",@$userinfo);
$smarty->assign("fillerror",@$fillerror);
$smarty->assign("main","help");
$smarty->assign("help_section",$section);
?>