===開発環境===

"; } else { // To $_to = "info@osawa-koumuten.com"; //$_to = "test@osawa-koumuten.com"; //From $_from = "info@osawa-koumuten.com"; //$_from = "test@osawa-koumuten.com"; // To //$_to_rireki = "info@osawa-koumuten.com"; $_to_rireki = "test@osawa-koumuten.com"; } // Reply-to $_reply_to = null; if (isset($_POST["cmd"])){ //var_dump($_POST); //var_dump($_SESSION); //POST $_indata = $_POST; if ($_POST["cmd"]=="input_back"){ $_html_template = "./htmltemp/contact.inc"; $_mode = "3"; }elseif ($_POST["cmd"]=="input"){ $ret = inputcheck(); if ($ret) { $_SESSION["ticket"] = md5(uniqid().mt_rand()); $_html_template = "./htmltemp/contact_chk.inc"; $_mode = "2"; }else{ $_html_template = "./htmltemp/contact.inc"; $_mode = "3"; } }elseif ($_POST["cmd"]=="send"){ if ($_POST["ticket"]==$_SESSION["ticket"]){ unset($_SESSION["ticket"]); // MAIL SEND PROC ================================================ // make mail title $_subject = "【自動送信】ホームページより、お問合せがありました。\n"; // make mail body $_content .= "\n"; $_content = "ホームページより下記のお問合せがありました。\n"; $_content .= "\n"; $_content .= "送信日時 :". date("Y/m/d H:i:s")."\n"; $_content .= "\n"; $_content .= "氏名 :".$_indata["_name"]."\n"; $_content .= "郵便番号 :".$_indata["_post"]."\n"; $_content .= "現在住所 :".$_indata["_address"]."\n"; $_content .= "連絡先TEL :".$_indata["_phone"]."\n"; $_content .= "その他連絡先TEL :".$_indata["mobile"]."\n"; $_content .= "E-mail :".$_indata["e-mail"]."\n"; if ($_indata["contact"]=="contact_phone"){ $_content .= "連絡方法 :電話\n"; } else { $_content .= "連絡方法 :E-mail\n"; } $_content .= "ご質問等 :\n"; $_content .= $_indata["free"]."\n"; $_content .= "\n"; $_content .= "※本メールは、入力内容を、そのまま送信しています。\n"; $_content .= "※また、等幅フォントにてご閲覧ください。\n"; $_content .= "\n"; $_content .= "\n"; $_content .= "\n"; $_content .= "\n"; $_content .= "================================\n"; $_content .= " メール送信プログラム \n"; $_content .= " Powered by PHP \n"; $_content .= "================================\n"; mb_language("ja"); mb_internal_encoding("SJIS"); $_header = "From: $_from\n"; if ($_reply_to!=""){ $_header .= "Reply-To: $_reply_to\n"; } else { $_header .= "Reply-To: $_from\n"; } $_header .= "X-Mailer: myphpMail ". phpversion(). "\n"; $_content = str_replace("\r", "", $_content); //echo '
$_to='.$_to; //echo '
$_subject='.$_subject; //echo '
$_content='.$_content; //echo '
$_header='.$_header; $ret = mb_send_mail($_to, $_subject, $_content, $_header); if ($ret){ $_html_template = "./htmltemp/contact_end.inc"; $_mode = "4"; } else { //echo '
$ret='.$ret; // echo "ERROR!!"; $_html_template = "./htmltemp/notfound.inc"; $_mode = "5"; // die; } if ($_to_rireki!=""){ // title $_subject = "【自動送信】お問合せページより投稿がありました。\n"; // body $_content = "お問合せページに投稿がありました。\n"; $_content .= "\n"; $_content .= "※本メールは、入力内容を、そのまま送信しています。\n"; $_content .= "※また、等幅フォントにてご閲覧ください。\n"; $_content .= "\n"; $_content .= "================================\n"; $_content .= " メール送信プログラム \n"; $_content .= " Powered by PHP \n"; $_content .= "================================\n"; $_content = str_replace("\r", "", $_content); mb_send_mail($_to_rireki, $_subject, $_content, $_header); } }else{ $_html_template = "./htmltemp/contact.inc"; $_mode = "1"; } }else{ $_html_template = "./htmltemp/contact.inc"; $_mode = "1"; } }else{ $_html_template = "./htmltemp/contact.inc"; $_mode = "1"; } // DEBUG //print_r( $_POST ); //echo "
mode = ".$_mode; // DEBUG //html $html_contents = file_get_contents($_html_template); switch ($_mode){ case "2": $html_contents = str_replace("{*NAME*}", $_indata["_name"], $html_contents); $html_contents = str_replace("{*POST*}", $_indata["_post"], $html_contents); $html_contents = str_replace("{*ADDRESS_VIEW*}", str_replace("\r\n","
",$_indata["_address"]), $html_contents); $html_contents = str_replace("{*ADDRESS*}", $_indata["_address"], $html_contents); $html_contents = str_replace("{*PHONE*}", $_indata["_phone"], $html_contents); $html_contents = str_replace("{*MOBLIE*}", $_indata["mobile"], $html_contents); $html_contents = str_replace("{*EMAIL*}", $_indata["e-mail"], $html_contents); if ($_indata["contact"]=="contact_phone"){ $html_contents = str_replace("{*CONTACT_VIEW*}", "電話", $html_contents); }else{ $html_contents = str_replace("{*CONTACT_VIEW*}", "E-mail", $html_contents); } $html_contents = str_replace("{*CONTACT*}", $_indata["contact"], $html_contents); $html_contents = str_replace("{*FREE_VIEW*}", str_replace("\r\n","
",$_indata["free"]), $html_contents); $html_contents = str_replace("{*FREE*}", $_indata["free"], $html_contents); $html_contents = str_replace("{*TICKET*}", $_SESSION['ticket'], $html_contents); // DEBUG $html_contents = str_replace("{*DEBUG*}", $_debug_title, $html_contents); break; case "3": $html_contents = str_replace("{*NAME*}", $_indata["_name"], $html_contents); $html_contents = str_replace("{*POST*}", $_indata["_post"], $html_contents); $html_contents = str_replace("{*ADDRESS*}", $_indata["_address"], $html_contents); $html_contents = str_replace("{*PHONE*}", $_indata["_phone"], $html_contents); $html_contents = str_replace("{*MOBLIE*}", $_indata["mobile"], $html_contents); $html_contents = str_replace("{*EMAIL*}", $_indata["e-mail"], $html_contents); if ($_indata["contact"]=="contact_phone"){ $html_contents = str_replace("{*CONTACT_PHONE_CHECK*}", "checked=\"checked\"", $html_contents); $html_contents = str_replace("{*CONTACT_EMAIL_CHECK*}", "", $html_contents); }else{ $html_contents = str_replace("{*CONTACT_PHONE_CHECK*}", "", $html_contents); $html_contents = str_replace("{*CONTACT_EMAIL_CHECK*}", "checked=\"checked\"", $html_contents); } $html_contents = str_replace("{*CONTACT*}", $_indata["contact"], $html_contents); $html_contents = str_replace("{*FREE*}", $_indata["free"], $html_contents); // DEBUG $html_contents = str_replace("{*DEBUG*}", $_debug_title, $html_contents); break; case "4": break; case "1": default: $html_contents = str_replace("{*NAME*}", "", $html_contents); $html_contents = str_replace("{*POST*}", "", $html_contents); $html_contents = str_replace("{*ADDRESS*}", "", $html_contents); $html_contents = str_replace("{*PHONE*}", "", $html_contents); $html_contents = str_replace("{*MOBLIE*}", "", $html_contents); $html_contents = str_replace("{*EMAIL*}", "", $html_contents); $html_contents = str_replace("{*CONTACT_PHONE_CHECK*}", "checked=\"checked\"", $html_contents); $html_contents = str_replace("{*CONTACT_EMAIL_CHECK*}", "", $html_contents); $html_contents = str_replace("{*FREE*}", "", $html_contents); // DEBUG $html_contents = str_replace("{*DEBUG*}", $_debug_title, $html_contents); } if ($_error_mes!=""){ $html_contents = str_replace("{*ERROR_MESSAGE*}", $_error_mes, $html_contents); }else{ $html_contents = str_replace("{*ERROR_MESSAGE*}", "", $html_contents); } echo $html_contents; function inputcheck(){ global $_indata; global $_error_mes; //必須 if ($_indata["_name"]==""){ $_error_mes .= "氏名を入力してください
\n"; } if ($_indata["_phone"]==""){ $_error_mes .= "電話番号を入力してください
\n"; } if ($_indata["free"]==""){ $_error_mes .= "お問合せ内容を入力してください
\n"; } if ($_indata["contact"]=="contact_E-mail"){ if ($_indata["e-mail"]==""){ $_error_mes .= "連絡方法をE-mailとする場合は、E-mailを入力してください
\n"; } } //内容チェック // if (!preg_match("/^[0-9]+$/", $_indata["year"])) { if ( $_indata["e-mail"]!=$_indata["e-mail_chk"] ) { $_error_mes .= "E-mailとE-mail(再入力)の内容が一致しません。再度、入力してください
\n"; } if ($_error_mes!=""){ $_error_mes = "" . $_error_mes . ""; return false; }else{ return true; } } ?>