$sysChoice=0;
require('include/config.php');
require('include/function.php');
require("include/clogin.php");
require("themes/".$sysSetting['Theme'].".php");
require_once('include/class.phpmailer.php');
if($sysSetting['RegType']<=1){
header("Location:error.php?ErrID=106");
die();
}
$remail = $_POST['remail'];
$op = $_POST['op'];
$confirmpass = $_REQUEST['confirmpass'];
$errmsg = "";
if($_POST['sendmail']=="true"){
$sql1="$sysBasic WHERE "
." `sUser`='".$_POST['reuser']. "' AND "
." `sMail`='".$_POST['remail']."' ";
$member2 = sysDbSet($sql1);
if(sysDbNums($member2)==1){
$cro = sysDbRows($member2);
$user = $cro['sUser'];
$pass = $cro['sPass'];
$wkey = $cro['sKey'];
$sysSetting['MailTop']=ereg_replace("@nFull@",$cro['nFull'],$sysSetting['MailTop']);
$sysSetting['MailTop']=ereg_replace("@sTitle@",$sysSetting['Title'],$sysSetting['MailTop']);
$sysSetting['MailBottom']=ereg_replace("@nFull@",$cro['nFull'],$sysSetting['MailBottom']);
$sysSetting['MailBottom']=ereg_replace("@sTitle@",$sysSetting['Title'],$sysSetting['MailBottom']);
$body = "以下是您在 ".$sysSetting['Title']." 會員系統之登入資料
";
if($op==1){
mb_internal_encoding('UTF-8');
$subject = mb_encode_mimeheader($sysSetting['Title']." 會員系統 / 忘記密碼", 'UTF-8');
$newpass=sysRandTxt(16);
$md5pass=md5($newpass);
sysDbSet("UPDATE `".$sysDbPrefix."_member` SET `sPass`='$md5pass' Where `sUser`='$user'");
$body = $sysSetting['MailTop'];
$body.= "已重設新的密碼組 :
"
."您的密碼已被重設,請勿遺失本郵件,否則無法取回您的密碼
"
."新的密碼 : $newpass
"
."請立即登入到 ".$sysSetting['Title']." 會員系統,更改這隨機密碼。
";
}else{
mb_internal_encoding('UTF-8');
$subject = mb_encode_mimeheader($sysSetting['Title']." 會員系統 / 忘記啟動碼", 'UTF-8');
$body.="新用戶請注意 :
"
."第一次登入系統時,您須要使用此啟動碼啟動您的帳號
"
."請按啟動碼 : ".$wkey." 直接啟動帳號
"
."或前往本站的本站,並登入本站系統,再輸入啟動碼以啟動您的帳號
";
}
$body.=$sysSetting['MailBottom']
."
系統網址 : ".$sysSetting['Location']."
"
."聯絡E-Mail : ".$sysSetting['Mail'];
//mail("$remail","$subject","$body","From: \"".$sysSetting['Title']."\" <".$nmsSetting['Mail'].">"); //or SysDie("不能寄出信件 ! ",__LINE__,__FILE__);
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
$from = $sysSetting['Mail'];
$to = $remail;
try
{
// Smtp Setting
$mail->Host = "smtp.gmail.com"; // SMTP server (sets GMAIL as the SMTP server)
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->CharSet = "utf-8"; // Sets the CharSet of the message
$mail->Encoding = "base64";
$mail->Username = $sysSetting['GmailAct']; // GMAIL username
$mail->Password = $sysSetting['GmailPass']; // GMAIL password
// Smtp Setting
// Setting the Sender, Receicer, ...
$mail->SetFrom($from, 'youngnet'); // Adds a "From" address.
$mail->AddAddress($to, 'member'); // Adds a "To" address.
$mail->AddReplyTo($from, 'youngnet'); // Adds a "Reply-to" address.
// Setting the Sender, Receicer, ...
// Setting the mail title, content ...
$mail->Subject = $subject;
$mail->Body = $body; // HTML Body
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true);
// $mail->AddAttachment('images/phpmailer.gif'); // attachment
// Setting the mail title, content ...
if(!$mail->Send()) {
$errmsg .="E-mail發送錯誤: " . $mail->ErrorInfo;
}else{$errmsg = "";}
} catch (phpmailerException $e) {
$errmsg .= $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
$errmsg .= $e->getMessage(); //Boring error messages from anything else!
}
if($op==1){
$errmsg = $errmsg."
您的新密碼已經寄到你E-Mail信箱中。
請返回您的E-Mail(".$to.")信箱取得登入的新密碼資料";
}else{
$errmsg = $errmsg."
您的啟動碼已經寄到你E-Mail信箱中。
請返回您的E-Mail(".$to.")信箱取得登入的啟動碼";
}
}else{
$sql2=$sysBasic." WHERE `sUser`='".$_POST['reuser']. "' ";
$member3=sysDbSet($sql2);
$tmprow=sysDbRows($member3);
$errmsg = $errmsg."
對不起,您的資料與本站的資料庫不符,請重新輸入.
";
$errmsg = $errmsg."會員系統中您所申請的E-Mail信箱為".$tmprow['sMail']."
";
$errmsg = $errmsg."如有錯誤煩請您與本基金會聯絡.";
}
}
if($confirmpass=="true" && $sysUsrInfo['sUser']!=""){
$joined=1;
}
THeader();
TNMS("忘記密碼");
?>
if($errmsg!="" || $errmsg){ ?>
echo $errmsg ?>
if($done=="" || !$done){$done="index.php";} ?>
返回上一頁
}else{ ?>
請填上您的會員帳號及E-Mail地址 : |
假若您知道會員帳號及密碼,請立即登入
} ?> TFooter(); ?>