',">", $mixed); return $mixed; } if (empty($_REQUEST["mode"])){ top(); exit; } if ($_REQUEST["mode"] == "confirm"){ confirm(); }else if($_REQUEST["mode"] == "complete"){ complete(); }else{ top(); } function top(){ $HeadHtm = file_get_contents("../common/html/2temp_header.html"); $BaseHtm = file_get_contents("temp_question.html"); $FootHtm = file_get_contents("../common/html/2temp_footer.html"); $HeadTitle ="お問合せ"; $HeadHtm = str_replace('$title$',$HeadTitle,$HeadHtm); $BaseHtm = str_replace('$header.html$',$HeadHtm,$BaseHtm); $BaseHtm = str_replace('$footer.html$',$FootHtm,$BaseHtm); print $BaseHtm; exit; } function confirm(){ session_start(); $_SESSION['campany'] = $_REQUEST["campany"]; $_SESSION['name'] = $_REQUEST["name"]; $_SESSION['name_kana'] = $_REQUEST["name_kana"]; $_SESSION['type'] = $_REQUEST["type"]; $_SESSION['zip'] = $_REQUEST["zip"]; $_SESSION['pref'] = $_REQUEST["pref"]; $_SESSION['add_1'] = $_REQUEST["add_1"]; $_SESSION['add_2'] = $_REQUEST["add_2"]; $_SESSION['tel'] = $_REQUEST["tel"]; $_SESSION['fax'] = $_REQUEST["fax"]; $_SESSION['mail_1'] = $_REQUEST["mail_1"]; $_SESSION['comment'] = $_REQUEST["comment"]; //入力内容のチェック checkData($dbc,$util,"new"); $HeadHtm = file_get_contents("../common/html/2temp_header.html"); $BaseHtm = file_get_contents("temp_confirm_ok.html"); $FootHtm = file_get_contents("../common/html/2temp_footer.html"); $HeadTitle ="お問合せ"; $HeadHtm = str_replace('$title$',$HeadTitle,$HeadHtm); $BaseHtm = str_replace('$header.html$',$HeadHtm,$BaseHtm); $BaseHtm = str_replace('$footer.html$',$FootHtm,$BaseHtm); $BaseHtm = str_replace('$campany$', $_SESSION['campany'], $BaseHtm); $BaseHtm = str_replace('$name$', $_SESSION['name'], $BaseHtm); $BaseHtm = str_replace('$name_kana$', $_SESSION['name_kana'], $BaseHtm); $BaseHtm = str_replace('$type$', $_SESSION['type'], $BaseHtm); $BaseHtm = str_replace('$zip$', $_SESSION['zip'], $BaseHtm); $BaseHtm = str_replace('$pref$', $_SESSION['pref'], $BaseHtm); $BaseHtm = str_replace('$add_1$', $_SESSION['add_1'], $BaseHtm); $BaseHtm = str_replace('$add_2$', $_SESSION['add_2'], $BaseHtm); $BaseHtm = str_replace('$tel$', $_SESSION['tel'], $BaseHtm); $BaseHtm = str_replace('$fax$', $_SESSION['fax'], $BaseHtm); $BaseHtm = str_replace('$mail_1$', $_SESSION['mail_1'], $BaseHtm); $BaseHtm = str_replace('$comment$', nl2br($_SESSION['comment']), $BaseHtm); print $BaseHtm; exit; } function complete(){ session_start(); // メール送信先を指定します。 // $bcc = "t_kousaka@admics.co.jp"; $to = "shop@baian-e.com"; $from = "shop@baian-e.com"; // フォームの値を取得します。 if ($_SERVER["REQUEST_METHOD"] != "POST") { exit(); } mb_internal_encoding("sjis"); mb_language("japanese"); $title2 = "HPよりお問合せ"; $naiyou2 .= "氏名    :".$_SESSION["name"]. "\n"; $naiyou2 .= "ふりがな  :".$_SESSION["name_kana"]. "\n"; $naiyou2 .= "会社名   :".$_SESSION["campany"]. "\n"; $naiyou2 .= "郵便番号  :".$_SESSION["zip"]. "\n"; $naiyou2 .= "都道府県  :".$_SESSION["pref"]. "\n"; $naiyou2 .= "ご住所   :".$_SESSION["add_1"]. "\n"; $naiyou2 .= "ビル名など :".$_SESSION["add_2"]. "\n"; $naiyou2 .= "電話番号  :".$_SESSION["tel"]. "\n"; $naiyou2 .= "FAX番号   :".$_SESSION["fax"]. "\n"; $naiyou2 .= "E-mail   :".$_SESSION["mail_1"]. "\n"; $naiyou2 .= "お問合せ内容:".$_SESSION["comment"]. "\n"; $addHeader .= "From: $from\n"; $isSuc = mb_send_mail($to,$title2,$naiyou2,$addHeader); // $isSuc = mb_send_mail($bcc,$title2,$naiyou2,$addHeader); if ($isSuc){ echo ""; } else { echo "メール送信失敗です"; } $HeadHtm = file_get_contents("../common/html/2temp_header.html"); $BaseHtm = file_get_contents("temp_complete.html"); $FootHtm = file_get_contents("../common/html/2temp_footer.html"); $HeadTitle ="お問合せ"; $HeadHtm = str_replace('$title$',$HeadTitle,$HeadHtm); $BaseHtm = str_replace('$header.html$',$HeadHtm,$BaseHtm); $BaseHtm = str_replace('$footer.html$',$FootHtm,$BaseHtm); print $BaseHtm; exit; } function checkData($dbc,$util,$mode){ $err = 0; $HeadHtm = file_get_contents("../common/html/2temp_header.html"); $BaseHtm = file_get_contents("temp_confirm_ng.html"); $FootHtm = file_get_contents("../common/html/2temp_footer.html"); $HeadTitle ="お問合せ"; $HeadHtm = str_replace('$title$',$HeadTitle,$HeadHtm); $BaseHtm = str_replace('$header.html$',$HeadHtm,$BaseHtm); $BaseHtm = str_replace('$footer.html$',$FootHtm,$BaseHtm); //担当者 if ($_REQUEST["name"] == ""){ $err++; $BaseHtm = str_replace('$name$', "氏名が入力されていません", $BaseHtm); } //ご住所 if ($_REQUEST["pref"] == ""){ $err++; $BaseHtm = str_replace('$pref$', "都道府県が入力されていません", $BaseHtm); } //ご住所 if ($_REQUEST["add_1"] == ""){ $err++; $BaseHtm = str_replace('$add_1$', "ご住所が入力されていません", $BaseHtm); } //TEL if ($_REQUEST["tel"] == ""){ $err++; $BaseHtm = str_replace('$tel$', "電話番号が入力されていません", $BaseHtm); } //メールアドレス if ($_REQUEST["mail_1"] == ""){ $err++; $BaseHtm = str_replace('$mail_1$', "E-mailが入力されていません", $BaseHtm); }else{ if (mailcheck($_REQUEST["mail_1"])){ $err++; $BaseHtm = str_replace('$mail_1$', "E-mailが正しくありません", $BaseHtm); } } //問合せ if ($_REQUEST["comment"] == ""){ $err++; $BaseHtm = str_replace('$comment$', "お問合せ内容が入力されていません", $BaseHtm); } if ($err > 0){ $BaseHtm = str_replace('$campany$', $_REQUEST['campany'], $BaseHtm); $BaseHtm = str_replace('$name$', $_REQUEST['name'], $BaseHtm); $BaseHtm = str_replace('$name_kana$', $_REQUEST['name_kana'], $BaseHtm); $BaseHtm = str_replace('$pref$', $_REQUEST['pref'], $BaseHtm); $BaseHtm = str_replace('$zip$', $_REQUEST['zip'], $BaseHtm); $BaseHtm = str_replace('$add_1$', $_REQUEST['add_1'], $BaseHtm); $BaseHtm = str_replace('$add_2$', $_REQUEST['add_2'], $BaseHtm); $BaseHtm = str_replace('$mail_1$', $_REQUEST['mail_1'], $BaseHtm); $BaseHtm = str_replace('$tel$', $_REQUEST['tel'], $BaseHtm); $BaseHtm = str_replace('$fax$', $_REQUEST['fax'], $BaseHtm); $BaseHtm = str_replace('$comment$', nl2br($_REQUEST['comment']), $BaseHtm); print $BaseHtm; exit; }else{ $BaseHtm = null; } } //----------------------------------------------------------------------------- //戻り値:OK=true,NG=false //----------------------------------------------------------------------------- function mailcheck($email){ if(preg_match('/^(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff])|"[^\\\\\x80-\xff\n\015"]*(?:\\\\[^\x80-\xff][^\\\\\x80-\xff\n\015"]*)*")(?:\.(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff])|"[^\\\\\x80-\xff\n\015"]*(?:\\\\[^\x80-\xff][^\\\\\x80-\xff\n\015"]*)*"))*@(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\\\x80-\xff\n\015\[\]]|\\\\[^\x80-\xff])*\])(?:\.(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\\\x80-\xff\n\015\[\]]|\\\\[^\x80-\xff])*\]))*$/',$email)){ return false; }else{ return true; } } ?>