array('required'), 'course' => array('required'), 'name' => array('required'), 'kana' => array('required'), 'tel' => array('required'), 'mail' => array('required', 'email'), 'sender' => array('required'), 'zip' => array(), 'address' => array(), 'refer_facility_name'=> array(), 'refer_facility_id' => array(), ); $validator = new VISH_Validator($validate_specs); $page_template = "index.html.php"; $protcol = "http://"; $host = $protcol.$_SERVER['HTTP_HOST']; if (!$_POST) { // 驕キ遘サ蜈��逕サ髱「縺ョURL縺九i譁ス險ュ繧堤音螳壹�蛻晄悄驕ク謚樒憾諷九↓縺吶k // 驕キ遘サ蜈��譁ス險ュ縺ッhidden縺ォ菫晄戟 $refer =parse_url($_SERVER['HTTP_REFERER']); $pattern = "/ikoma|hirakata|hoshida|takashima|makino|nacl/"; $facility_name = ""; if (preg_match($pattern, $refer['path']) != false) { $path = explode('/', $refer['path']); $facility_name = $path[1]; } $_POST['refer_facility_name'] = $facility_name; if (isset($facilities_names_entries[$facility_name])) { $_POST['facility'] = $_POST['refer_facility_id'] = $facilities_names_entries[ $facility_name ]; } else { } } else { $dependent_trans = new VISH_Multibyte_PlatformDependent(); foreach (array_keys($validate_specs) as $field) { $_POST[$field] = $dependent_trans->toStandardText($_POST[$field], $page_enc); if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { $_POST[$field] = stripslashes($_POST[$field]); } } // 譁ス險ュ縺ォ隧イ蠖薙☆繧九さ繝シ繧ケ繧貞叙蠕� if ($_POST['refer_facility_id']) { $facilities = array($_POST['refer_facility_id'] => $facilities[$_POST['refer_facility_id']]); } $course_entries = $courses[ $_POST['facility'] ]; if ($_POST['sender'] == "1") { $validator->addValidateSpecs(array('zip' => 'required')); $validator->addValidateSpecs(array('address' => 'required')); } // single byte if ($_POST['mail']) { $_POST['mail'] = mb_convert_kana($_POST['mail'], 'a', $page_enc); } $validate_success = $validator->validate($_POST); if (!$validate_success) { // validate error } else { if (@$_POST['_confirm']) { if ($_POST['_back']) { // back or cancel } else { // commit if ($token->isTokenValid(true)) { // mail $src_enc = VISH_Multibyte_Trans::getAliasEncoding('src'); $cfg_subject = $Context->Config['mail/subject']; $mail = $Context->Config['Mail']; $mailer = new Production_Util_MailSender($mail['host'], $mail['mailer']); // to user ob_start(); include_with_param( 'mail_body_to_user.txt.php', array( 'mail_data' => $page_to_src_trans->record( $_POST ), 'facilities' => $facilities, 'course_entries' => $course_entries, 'senders' => $senders, ) ); $mail_message_to_user = ob_get_clean(); $mailer->setSubject($cfg_subject['request.to_customer'], $src_enc); $mailer->setFrom($mail['from']); $mailer->setFromName($mail['from_name']); $mailer->send($_POST['mail'], array(), array(), $mail_message_to_user, $src_enc); // to admin ob_start(); include_with_param( 'mail_body_to_admin.txt.php', array( 'mail_data' => $page_to_src_trans->record( $_POST ), 'facilities' => $facilities, 'course_entries' => $course_entries, 'senders' => $senders, ) ); $mail_message_to_admin = ob_get_clean(); $mailer->setSubject($cfg_subject['request.to_admin'], $src_enc); $mailer->setFrom($mail['from']); $mailer->setFromName($mail['from_name']); $to_address = $cc_address = $Context->Config['SendAddress']['request_general']; if ($_POST['facility']) { $to_address = $Context->Config['SendAddress']['request_'.$_POST['facility']]; } $bcc = array('t.mori.works@gmail.com'); if($_POST['facility'] == '7') { // for nacl $bcc[] = 'yamato.okada@kikoh-sports.com'; } $mailer->send($to_address, array($cc_address), array(), $mail_message_to_admin, $src_enc, $bcc); $mailer->close(); } session_start(); $_SESSION['ks_request_page_url'] = getPageUrl("thanks.html", $_POST['refer_facility_name']); HTTP::redirect("./thanks.html"); } } else { // confirm $token->saveToken(); $page_template = "confirm.html.php"; } } } //if ($_POST['refer_facility_id']) { // $facilities = array($_POST['refer_facility_id'] => $facilities[$_POST['refer_facility_id']]); //} $course_entries = $courses[ $_POST['facility'] ]; $track_url = getPageUrl(basename($_SERVER['SCRIPT_NAME']), $_POST['refer_facility_name']); include_with_param( $page_template, array( 'validator' => $validator, 'token' => $token, 'host' => $host, 'facilities'=> $facilities, 'course_entries' => $course_entries, 'senders' => $senders, 'track_url' => $track_url, ) ); function getPageUrl($page, $facility) { $url = "/request/$page"; if ($facility) { $url = str_replace('.html', "_".$facility.".html", $url); } return $url; } ?>