NoCacheHeader = false; if ($_POST[cmd]=="confirm"){ $tbs->escape_post(); if (formCheck(&$tbs)){ $_SESSION[to_inquiry] = $_POST; $tbs->LoadTemplate("inquiry2.template", "UTF-8"); } else { $tbs->LoadTemplate("inquiry.template", "UTF-8"); } } elseif ($_POST[cmd]=="submit" && $_SESSION[to_inquiry][name]<>""){ $arySQL = array( "dateinserted" => date("Y/m/d H:n:s"), "name" => $_SESSION[to_inquiry][name], "kana" => $_SESSION[to_inquiry][kana], "postal" => $_SESSION[to_inquiry][postal], "address" => $_SESSION[to_inquiry][address], "email" => $_SESSION[to_inquiry][email], "tel" => $_SESSION[to_inquiry][tel], "contact" => iif($_SESSION[to_inquiry][contact]=="電話", "T", iif($_SESSION[to_inquiry][contact]=="メール", "M", "")), "comment" => $_SESSION[to_inquiry][comment], "hostip" => $_SERVER[REMOTE_ADDR], "hostname" => gethostbyaddr($_SERVER[REMOTE_ADDR]), ); $sql = _sql_insert("to_inquiry", $arySQL); mysql_query($sql) or die("sql error
$sql"); $arySQL[contact] = $_SESSION[to_inquiry][contact]; $mailText = _readTextFile("inquiry_confirm.mail"); $mailText = _replaceText($mailText ,$arySQL); $mailText = str_replace("
", "\n", $mailText); _sendMail("info@aoki-sports.com", $_SESSION[to_inquiry][email], "お問い合わせありがとうございます", $mailText); _sendMail("info@aoki-sports.com", "info@aoki-sports.com", "お問い合わせがありました", $mailText); unset($_SESSION[to_inquiry]); $tbs->LoadTemplate("inquiry3.template", "UTF-8"); } else { $tbs->LoadTemplate("inquiry.template", "UTF-8"); } $tbs->Show(); function formCheck($tbs){ $aryHankakuField = array( "postal", "email", ); foreach ($aryHankakuField as $key => $field){ $_POST[$field] = mb_convert_kana($_POST[$field], "a", "UTF-8"); } $aryCheckField = array( "email" => "メールアドレス", "name" => "お名前", "kana" => "ふりがな", "comment" => "コメント", ); $errField = array(); $errTitle = array(); if ($_POST[directMail]=="希望しない"){ $_POST[contact] = ""; } foreach ($aryCheckField as $key => $fieldTitle){ if (trim($_POST["$key"])==""){ $errField[] = $key; $errTitle[] = $fieldTitle; } } return count($errField)==0; } function _before_loadtemplate($tbs){ $tbs->TplVars[dirRoot] = ".."; } function _after_loadtemplate($tbs){ } ?>