/* -- do NOT protect the forget password form -- */
$L3_Protected=0;
/* -- Skip checks with the Access Control List as this is not Admin Center -- */
$L3_SkipMainACL=1;
if (is_file("setup.conf")) { include("setup.conf"); } else { include("../setup.conf"); }
if (is_file("../common/templates/header.phtml")) { include("../common/templates/header.phtml"); }
else { include("templates/header.phtml") ; }
$L3_CC = new L3_ClientCenter;
$IDName = $L3_Lang->get_Label("forgotpw_form_uid");
$L3_Lang->set_ReplacementArray("IDName", $IDName);
$L3_Lang->set_ReplacementArray("SourceName", $SourceName);
if ($L3_Config->get_GlobalConfig("Portal_ID") == "3")
$L3_Lang->set_ReplacementArray("Support", "Technical Support");
else if ($L3_Config->get_GlobalConfig("Portal_ID") == "1")
$L3_Lang->set_ReplacementArray("Support", "Customer Service");
$L3_Mesg = new L2_Message;
?>
if (is_file("../common/templates/bodystart.phtml")) { include("../common/templates/bodystart.phtml"); }
else { include("templates/bodystart.phtml") ; }
?>
$myError="";
if ($Action=="Update") {
$query="select * from auth_user
where username='$userid'";
$L3_CC->query($query);
$L3_CC->next_record();
$passwd = $L3_CC->f("password");
$UserLevel = $L3_CC->f("perms");
/* --Change Password using md5 - By Sabrina-- */
$passwd = $L3->genpwd() ;
//echo "New 8 Digit Password :" . $passwd ;
/* --End of change-- */
if($L3_Config->get_GlobalConfig("Portal_ID") == 2)
{ // gb portal
$mail_Subject = "Request for Password - " . $L3_Config->get_GlobalConfig("Portal_Name");
$mail_Extra = "From: ". $L3_Config->get_GlobalConfig("Portal_CSEmail") . "\nContent-Type: text/plain;charset=gb2312\n";
}
else
{
$mail_Subject = "Request for Password - " . $L3_Config->get_GlobalConfig("Portal_Name");
$mail_Extra = "From: " . $L3_Config->get_GlobalConfig("Portal_CSEmail");
}
if ($L3_CC->f("perms")=="Nobody")
{
$query="select * from Company
where CompanyID='$userid'";
$L3_CC->query($query);
if ($L3_CC->next_record())
{
if ($L3_CC->f("AdminContactEmail") == "")
{
$mailer= $L3_Config->get_GlobalConfig("Portal_CSEmail");
$mailerName="Webmaster";
if($L3_Config->get_GlobalConfig("Portal_ID") == 2)
{ // gb portal
$mail_Filename = "attachments/gb_email_prod_forgotpw.txt";
$replaceArray = array("mailerName"=>$mailerName,
"userid"=>$userid);
}
else
{
$mail_Filename = "attachments/email_prod_forgotpw.txt";
$replaceArray = array("mailerName"=>$mailerName,
"userid"=>$userid);
}
}
else
{
$mailer=$L3_CC->f("AdminContactEmail");
$mailerName=$L3_CC->f("AdminContact");
if($L3_Config->get_GlobalConfig("Portal_ID") == 2)
{ // gb portal
$mail_Filename = "attachments/gb_email_user_forgotpw.txt";
$replaceArray = array("Portal_Name"=>$L3_Config->get_GlobalConfig("Portal_Name"),
"Portal_DomainName"=>$L3_Config->get_GlobalConfig("Portal_URL"),
"SourceName"=>$SourceName,
"SourceURL"=>$SourceURL,
"IDName"=>$IDName,
"userid"=>$userid,
"passwd"=>$passwd
);
}
else
{
$mail_Filename = "attachments/email_user_forgotpw.txt";
$replaceArray = array("Portal_Operator"=>$L3_Config->get_GlobalConfig("Portal_Name"),
"Portal_DomainName"=>$L3_Config->get_GlobalConfig("Portal_URL"),
"SourceName"=>$SourceName,
"SourceURL"=>$SourceURL,
"IDName"=>$IDName,
"userid"=>$userid,
"passwd"=>$passwd
);
}
}
/* --Update md5 password - By Sabrina-- */
$L3->Database = "INPlasticsYP" ;
$L3->update_Password($userid, $passwd) ;
//echo "
Update Done" . $temp . "" ;
/* --End of change-- */
$L3_Mesg->send_Mail ($mail_Filename,
$mailer,
$mail_Subject,
$mail_Extra,
$replaceArray);
// if (!$retVal) $myError = "Mail alert failed to send.
\n";
$L3_CC->AddtoLog($userid, $userid,62 ,3);
} else $myError = $L3_Lang->get_Label("forgotpw_label_error");
}
else if ($L3_CC->f("perms")=="User") {
$query="select * from UserRegistration
where UserID='$userid'";
$L3_CC->query($query);
if ($L3_CC->next_record()) {
if ($L3_CC->f("SenderEmail") == "") {
$mailer=$L3_Config->get_GlobalConfig("Portal_CSEmail");
$mailerName=$L3_CC->f("SenderName");
if($L3_Config->get_GlobalConfig("Portal_ID") == 2)
{ // gb portal
$mail_Filename = "attachments/gb_email_prod_forgotpw.txt";
$replaceArray = array("mailerName"=>$mailerName,
"userid"=>$userid);
}
else
{
$mail_Filename = "attachments/email_prod_forgotpw.txt";
$replaceArray = array("mailerName"=>$mailerName,
"userid"=>$userid);
}
} else {
$mailer=$L3_CC->f("SenderEmail");
$mailerName=$L3_CC->f("SenderName");
if($L3_Config->get_GlobalConfig("Portal_ID") == 2)
{ // gb portal
$mail_Filename = "attachments/gb_email_user_forgotpw.txt";
$replaceArray = array("Portal_Name"=>$L3_Config->get_GlobalConfig("Portal_Name"),
"Portal_DomainName"=>$L3_Config->get_GlobalConfig("Portal_URL"),
"SourceName"=>$SourceName,
"SourceURL"=>$SourceURL,
"IDName"=>$IDName,
"userid"=>$userid,
"passwd"=>$passwd
);
}
else
{
$mail_Filename = "attachments/email_user_forgotpw.txt";
$replaceArray = array("Portal_Name"=>$L3_Config->get_GlobalConfig("Portal_Name"),
"Portal_DomainName"=>$L3_Config->get_GlobalConfig("Portal_URL"),
"SourceName"=>$SourceName,
"SourceURL"=>$SourceURL,
"IDName"=>$IDName,
"userid"=>$userid,
"passwd"=>$passwd
);
}
}
/* --Update md5 password - By Sabrina-- */
$L3->update_Password($userid, $passwd) ;
//echo "
Update Done" . $temp . "" ;
/* --End of change-- */
$L3_Mesg->send_Mail ($mail_Filename,
$mailer,
$mail_Subject,
$mail_Extra,
$replaceArray);
// if (!$retVal) $myError = "Mail alert failed to send.
\n";
$L3_CC->AddtoLog($userid, $userid,62 ,3);
} else $myError = $L3_Lang->get_Label("forgotpw_label_error");
} else
$myError = $L3_Lang->get_Label("forgotpw_label_error");
}
?>