func_code = "contact_us"; $func_title = array ( 'tw' => '聯絡我們', 'cn' => '联络我们', 'en' => 'Contact Us', ); $CFG->func_title = $func_title[$CFG->lang]; $CFG->title_disable = 1; //定義資料表 $CFG->table_admin = $CFG->table_prefix."admin"; $CFG->table_name = $CFG->table_prefix."contact_us"; $CFG->table_forum = $CFG->table_prefix."forum"; $CFG->folder_path = $WFunc->get_archive_folder($CFG->func_code); // 上傳目錄 // ---------------------------------------------------------------------------- // 主判斷式 // ---------------------------------------------------------------------------- if ($_REQUEST["mode"]) { $_REQUEST["mode"]($_REQUEST); } else { $_SESSION['web']['back_url'] = $CFG->this_url; show($_REQUEST); } // 主判斷式結束 // ---------------------------------------------------------------------------- // 函式集 // ---------------------------------------------------------------------------- function show($frm) { global $CFG,$WFunc,$UFunc; $next_mode = "insert"; #################################################################### # 載入樣板 #################################################################### // 頁首 !$_REQUEST['pjax'] ? include ($CFG->themes."header.php") : false; include ($CFG->lib."funcs/header_func.php"); // 畫面 include ("themes/$CFG->lang/form.php"); // 頁尾 !$_REQUEST['pjax'] ? include ($CFG->themes."footer.php") : false; } function insert($frm) { global $CFG,$WFunc,$UFunc,$MailContent,$_FILES; $field = array ( 'type' => 'contact_us', 'title' => $frm['title'], 'name' => $frm['name'], 'phone' => $frm['phone'], 'email' => $frm['email'], 'address' => $frm['address'], 'content' => $frm['content'], 'lang' => $CFG->lang, 'date' => $CFG->now, 'status' => 1, ); $insert_string = $WFunc->sql_insert_string($CFG->table_name,$field); mysql_query($insert_string); //信件所需欄位 $content_array = array ( 'subject' => $frm['title'], 'name' => $frm['name'], 'phone' => $frm['phone'], 'email' => $frm['email'], 'address' => $frm['address'], 'content' => nl2br($frm['content']), 'post_date' => $CFG->now, ); foreach ($content_array as $field => $value) { $MailContent->$field = $value; } //處理郵件內容 $MailContent->recipient = $CFG->admin_email; $MailContent->template = "themes/$CFG->lang/email.php"; $MailContent->from_name = "[$MailContent->name] $CFG->web_title - 系統通知信件"; $MailContent->title = "您有一個新的留言 - ".$MailContent->name; $MailContent->body = $WFunc->mail_template($MailContent->template); $admin_query_string = "SELECT * FROM $CFG->table_admin WHERE permissions LIKE '%contact_us%' AND status = '1'"; $admin_db_result = mysql_query($admin_query_string); while ($admin_result = mysql_fetch_assoc($admin_db_result)) { //傳送信件 $WFunc->send_mail($MailContent->from_name,$MailContent->recipient,$admin_result['email'],$MailContent->title,$MailContent->body); } $CFG->back_url = $_SESSION['web']['back_url']; //更新完畢,轉回畫面 $message['tw'] = '訊息已成功送出,感謝您的來信,我們將盡速與您聯繫,謝謝!'; $message['cn'] = '讯息已成功送出,感谢您的来信,我们将尽速与您联系,谢谢!'; $message['en'] = 'message has been sent successfully, thank you for your letter, we will contact you as soon as possible, thank you!'; #################################################################### # 載入樣板 #################################################################### // 頁首 !$_REQUEST['pjax'] ? include ($CFG->themes."header.php") : false; include ($CFG->lib."funcs/header_func.php"); // 畫面 include ($CFG->themes."notice.php"); // 頁尾 !$_REQUEST['pjax'] ? include ($CFG->themes."footer.php") : false; } ?>