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']==0){
header("Location:".$sysSetting['Location']."/error.php?ErrID=108");
die();
}
$wkey = sysRandTxt(50);
$date = date("Y-m-d");
$smsg="";
$msg="";
$sUser = $_POST["sUser"];
$pass = $_POST["pass"];
$repass = $_POST["repass"];
$sMail = $_POST["sMail"];
$phone = $_POST["phone"];
$cellphone = $_POST["cellphone"];
$cemail = $_POST["cemail"];
$nickname = $_POST["nickname"];
$fullname = $_POST["fullname"];
$sex = $_POST["sex"];
$mYear = $_POST["mYear"];
$mMonth = $_POST["mMonth"];
$mDay = $_POST["mDay"];
$home = $_POST["home"];
$notes = $_POST["notes"];
$showinfo = "true";
$address = $_POST["address"];
$zipcode = $_POST["PostNo"];
$city = $_POST["City"];
$canton = $_POST["Canton"];
$school = $_POST["school"];
$dep = $_POST["dep"];
$vimage = $_POST["vimage"];
$oimage = $_SESSION["verification__session"];
if($sysUsrInfo['sLogin']=="true"){
$smsg=" - 您已經是本站的會員,不必再次申請 ;
\n";
}
if ($_POST["register"] == "nmsform" && $smsg=="") {
if($_POST["agree"]!="true"){
$msg.=" - 您需要「同意」本會員系統的會員申請條款才可申請會員帳號 ;
\n";
}
if(!ereg("^([a-z]|[A-Z]|[0-9]|_|\-)+$",$sUser) || $sUser==''){
$msg.=" - 會員帳號必要是英文字母、數字或可用符號 '_' , '-' 組成 ;
\n";
}
if(!ereg("^[[:alnum:]]+$",$pass) || $pass==''){
$msg.=" - 密碼必要是英文字母、數字組成 ;
\n";
}
if(!ereg("^([a-z]|[A-Z]|[0-9]|_|\-)*(\.)*([a-z]|[A-Z]|[0-9]|_|\-)+@(.*)$",$sMail) || $sMail==''){
$msg.=" - E-Mail地址的格式必要是英文字母、數字或可用符號 '@' , '_' , '-' , '.' 組成 ;
\n";
}
if(sysDbNums(sysDbSet($sysBasic." WHERE `sMail`='$sMail' "))!=0){
$msg.=" - E-Mail地址已被使用;
\n";
}
if(sysDbNums(sysDbSet($sysBasic." WHERE `sUser`='$sUser' "))!=0){
$msg.=" - 會員帳號已存在;
\n";
}
if(!ereg("^([0-9]|_|\-)+$",$phone) || $phone==''){
$msg.=" - 聯絡電話必要是數字'0-9'組成 ;
\n";
}
if(!ereg("^([0-9]|_|\-)+$",$cellphone) || $cellphone==''){
$msg.=" - 行動電話必要是數字'0-9'組成 ;
\n";
}
if($_SESSION["verification__session"] != $vimage){
$msg.=" - 驗證碼輸入錯誤 ;
\n";
}
else{
unset($_SESSION["verification__session"]);
}
if(!check_identity($sUser)){
$msg.=" - 身份證號碼驗證有誤 ;
\n";
}
//$fullname = mb_encode_mimeheader($fullname, 'UTF-8');
if($msg=="") {
if($sysSetting['RegType']==3){$ulevel=0;}else{$ulevel=1;}
if($sysSetting['RegType']==4){$pass = sysRandTxt(16);}else{$pass=$_POST['pass'];}
if($sysSetting['RegType']!="0" || $sysSetting['RegType']!="1"){
$sysSetting['MailTop']=ereg_replace("@nFull@",$fullname,$sysSetting['MailTop']);
$sysSetting['MailTop']=ereg_replace("@sTitle@",$sysSetting['Title'],$sysSetting['MailTop']);
$sysSetting['MailBottom']=ereg_replace("@nFull@",$fullname,$sysSetting['MailBottom']);
$sysSetting['MailBottom']=ereg_replace("@sTitle@",$sysSetting['Title'],$sysSetting['MailBottom']);
//mb_internal_encoding('UTF-8');
//$subject = mb_encode_mimeheader($sysSetting['Title']." 會員系統 / 加入會員", 'UTF-8');
$subject = $sysSetting['Title']." 會員系統 / 加入會員";
$body= $sysSetting['MailTop'];
$body.= "
恭喜您,您已經成為 ".$sysSetting['Title']." 的會員
"
."以下是您的登入資料,請勿遺失,管理員是無法取得您的登入資料
"
."使用者名稱 : $sUser
"
."使用者密碼 : $pass
"
."感謝您使用本站的服務
";
if($sysSetting["RegType"]==3){
$body .="第一次登入系統時,您須要使用此啟動碼啟動您的會員帳戶
"
."請按啟動碼 : ".$wkey." 直接啟動帳號
"
."或前往本站的本站,並登入本站系統,再輸入啟動碼以啟動您的帳號
";
}
$body.=$sysSetting['MailBottom']
."
系統網址 : ".$sysSetting['Location']."
"
."聯絡E-Mail : ".$sysSetting['Mail'];
$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 = $sMail;
try
{
// Smtp Setting
$mail->Host = "smtp.gmail.com"; // SMTP server (sets GMAIL as the SMTP server)
$mail->SMTPDebug = 2; // 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, 'new 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()) {
$smsg .="E-mail發送錯誤: " . $mail->ErrorInfo;
}
} catch (phpmailerException $e) {
$smsg .= $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
$smsg .= $e->getMessage(); //Boring error messages from anything else!
}
//mail($sMail, $subject, $body1, $headers1);// or SysDie("不能寄出信件 ! ",__LINE__,__FILE__);
}
$newpass=md5($pass);
$sUser = strtoupper($sUser);
$insertSQL = "INSERT INTO `".$sysDbPrefix."_member` "
."(`sLevel`, `sUser`, `sPass`, `sMail`, `mIcq`, `mSite`,`mPhone`, `nFull`, `nDisplay`, "
."`mAddress`, `mSex`, `mNote`, `sKey`, `sAddDate`,`sVinfo`,`sHits`,`mYear`,`mMonth`,`mDay`,`school`,`dep`,`cellphone`) "
."VALUES ('$ulevel', '$sUser', '$newpass', '$sMail', '$icq', '$url','$phone', '$fullname', '$nickname', "
."'$zipcode $home', '$sex', '$notes', '$wkey', '$date','$showinfo','0','$mYear','$mMonth','$mDay','$school','$dep','$cellphone')";
$Result1 = sysDbSet($insertSQL);
//echo $insertSQL."|".$smsg."|".$body;
header("Location:confirm.php?user=$sUser&done=$done");
}else{
$zipcode = "";
}
}
THeader();
TNMS("申請新會員");
?>
|
|
- 您申請會員時發生以下錯誤 : |
|
- 您申請會員時發生以下錯誤 : |