Config['Upload']; $upload = new VISHx_FileUpload($upload_path['user_temp_dir']); //バリデーション定義 mb_regex_encoding("utf8"); $validate_specs = array( 'kind' => array('required'), 'photo' => array(), // 別途チェック 'job_category' => array('required'), 'job_time' => array('required'), 'name' => array('required'), 'kana' => array('required', array('mbereg', '^[ヲ-゚ァ-ヶー  ]*$')), 'sex' => array('required'), 'age' => array('required'), 'birth_y' => array(), 'birth_m' => array(), 'birth_d' => array(), 'e-mail' => array('required', 'email'), 'zip1' => array('required', array('mbereg', '^[0-9\-]*$')), 'address' => array('required'), 'tel' => array('required', array('mbereg', '^[0-9\-\(\)]*$')), 'school_name' => array('required'), 'undergraduate' => array('required'), 'is_graduation' => array('required'), 'keireki' => array('required'), 'shikaku' => array(), 'pr' => array(), 'comment' => array(), ); //バリデータ作成 $validator = new VISH_Validator($validate_specs); if(!$_POST) { //初期表示 $upload->init(); $template = "index.html.php"; if (isset($_GET['p']) && 0 < strlen($_GET['p'])) { $_POST['item'] = $_GET['p']; unset($_GET['p']); } } else { $upload->keep(); $validate_success = $validator->validate($_POST); // 画像アップチェック if($upload->hasUploaded('photo') === false) { $validate_success = false; $validator->setError('photo', 'required'); } if($_POST['_confirm']){ //入力画面で確認ボタン押下 if($validate_success) { $token->saveToken(); $template = 'kakunin.html.php'; } else { $template = 'index.html.php'; } } else if($_POST['_commit']) { if($_POST['_shuusei'] == '1') { //確認画面で修正ボタン押下 $template = 'index.html.php'; } else { // メール送信 if ($token->isTokenValid(true)) { $upload_files = array(); $upload_files[] = array($upload->getUploadedFullpath('photo'), $upload->getUploadedFilename('photo')); // 利用者宛に送信 $page_to_mail_trans = new VISH_Multibyte_Trans('page', 'mail'); //機種依存文字対応 $dependent_trans = new VISH_Multibyte_PlatformDependent(); foreach($_POST as $k => $v) { if(is_array($v)) { foreach($v as $vv) { //$maildata[$k][] = $dependent_trans->toStandardText($page_to_mail_trans->value($vv, 'UTF-8'), 'CP932', 'UTF-8'); $maildata[$k][] = $vv; } } else { $maildata[$k] = $v; } } $from = $Context->Config['Contact']['entry_from']; $to_admin_array = explode(',', $Context->Config['Contact']['entry_to']); $admin_subject = $Context->Config['mail/subject']['entry.to_admin']; $customer_subject = $Context->Config['mail/subject']['entry.to_customer']; $mail = new Qdmail( 'UTF-8', 'base64' ); //$mail->debug(2); $mail->unitedCharset('UTF-8'); // 利用者に送信 ob_start(); include_with_param('mail_to_customer.txt.php', array( 'maildata'=>$maildata, )); $mail_message_to_customer = ob_get_clean(); $mail->to($_POST['e-mail']); $mail->subject($customer_subject); $mail->text($mail_message_to_customer); // 利用者宛メールに画像は載せない // $mail->attach($upload_files); // 添付ファイル $mail->from($from); $mail->send(); // 問い合わせ担当者宛に送信(利用者と同一の内容) ob_start(); include_with_param('mail_to_admin.txt.php', array( 'maildata'=>$maildata, )); $mail_message_to_admin = ob_get_clean(); $mail->unitedCharset( 'UTF-8' ); $mail->to($to_admin_array, $to_admin_array); $mail->subject($admin_subject); $mail->text($mail_message_to_admin); $mail->attach($upload_files); // 添付ファイル $mail->from($from); $mail->send(); $upload->deleteUploaded('photo'); // アップロードされたファイルを削除 } // 完了画面へリダイレクト if(preg_match('/test/', dirname($_SERVER['SCRIPT_NAME'])) !== 0) { $url = 'https://'.$_SERVER['HTTP_HOST'].'/test/recruit/carrier/entry/thanks.html'; } else if(preg_match('/onda/', dirname($_SERVER['SCRIPT_NAME'])) !== 0) { $url = 'https://'.$_SERVER['HTTP_HOST'].'/onda/recruit/carrier/entry/thanks.html'; } else { $url = 'https://'.$_SERVER['HTTP_HOST'].'/recruit/carrier/entry/thanks.html'; } header('Location: '.$url); exit; } } } include_with_param($template, array( 'validator' => $validator, 'upload' => $upload, 'token' => $token, ));