connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, true)) $dao->print_last_error(false); //DB-------------------------------------------------------------- $sql="select DM_Acc,DM_Pass,DM_Email,DM_Id from Dist_Mem where DM_Acc='".$DM_Acc."' and DM_Flag='Y' and DM_UniNo='".$DM_UniNo."'"; //echo $sql."
"; $dao->select($sql); if ( $dao->row_count !='0' ) { $row = $dao->getRecord(); $DM_Pass=$row['DM_Pass']; $DM_Email=$row['DM_Email']; $DM_Id=$row['DM_Id']; //測試寄信功能 $emails =$DM_Email; $mail = new PHPMailer(); $mail->SetLanguage("en", '../../admin/system/phpMailer/language/'); $mail->IsSMTP(); $pos1 = strpos($emails, "@zyxel.com.tw"); $pos2 = strpos($emails, "@mitrastar.com.tw"); $pos3 = strpos($emails, "@unizyx.com.tw"); if ($pos1!='' || $pos2!='' || $pos3!='') { //echo "Y"; $mail->Host = "msa.hinet.net"; } else{ //echo "N"; $mail->Host = "localhost"; } $mail->From = "systp@zyxel.com.tw"; $mail->FromName = "AP systp"; $mail->IsHTML(true); $Subject="經銷商專區 | ZyXEL-忘記密碼"; $title = "$Subject"; $url="http://event.zytpe.com.tw/zytpe/resellers/resellers_forgot.php?DM_Id=".$DM_Id; $body .= file_get_contents($url); //echo $body; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $mail->Body = str_replace("]]","",str_replace("[[","",str_replace("%name%",$names,$body))); $mail->Subject = $title; $mail->AddAddress($emails, $names,$headers); if($mail->Send()){ $mail_send="OK"; // echo $mail_send."
"; // echo "Mailer Error: " . $mail->ErrorInfo; } $error_text="密碼已寄送至連絡信箱!"; $error_url="../resellers/resellers_03_1.php"; }//if ( $dao->row_count !='0' ) { else{ //無符合條件 $error_text="帳號或者密碼錯誤!"; $error_url="../resellers/resellers_01.php"; } //------------------------------------------------------ $dao->end_db; ?>