$question = htmlspecialchars($question); $answer = $_POST['answer']; $answer = trim($answer); $answer = stripslashes($answer); $answer = htmlspecialchars($answer); $mail = $_POST['mail']; $mail = trim($mail); $mail = stripslashes($mail); $mail = htmlspecialchars($mail); $first_name = $_POST['first_name']; $first_name = trim($first_name); $first_name = stripslashes($first_name); $first_name = htmlspecialchars($first_name); $last_name = $_POST['last_name']; $last_name = trim($last_name); $last_name = stripslashes($last_name); $last_name = htmlspecialchars($last_name); $birthdate = $_POST['birthdate']; function Validation($user_name, $pass, $repeat_pass, $question, $answer, $mail, $first_name, $last_name, $birthdate) { if (!empty($user_name) && !empty($pass) && !empty($repeat_pass) && !empty($question) && !empty($answer) && !empty($mail) && !empty($first_name) && !empty($last_name) && !empty($birthdate) && $pass == $repeat_pass) { return true; } else { return false; } } if (Validation($user_name, $pass, $repeat_pass, $question, $answer, $mail, $first_name, $last_name, $birthdate)) { echo "Успешна регистрация!"; } else { echo "Моля, попълнете всички данни коректно!"; }
$form['mode'] = 'regist'; break; // 応募完了→メール送信 // 応募完了→メール送信 default: break; //デフォルト:フォーム表示 } // 処理スタート switch ($form['mode']) { // 入力内容確認 case 'check': $template = "check"; $form = Get_FormData($obj, $form); //出力用のフォーム値を取得 $err = Validation($form); //エラーチェック if ($err) { //print '<script>alert("応募内容に未入力の項目があります。\n応募フォームをご確認ください")</script>'; $template = "index"; $form = SetData($form); } //*********** 自作セッション(二重送信対策) **************** if (!$err) { //ユニークな文字を作成、check.tplにhiddenで埋込 $form['uniq'] = makePassword(); //ファイル名の指定 $file_name = $data['cgi_path'] . $form['uniq'] . '.cgi'; if (!file_exists($file_name)) { touch($file_name); //ファイル作成
public static function select_key_intersection($keys, $input, $setting = null, $param = null) { if ($setting['setError']) { return; } if (!isset($param)) { throw new Exception('Selection rule \'' . __METHOD__ . '\', missing parameter.'); } $tempKeys = null; $f = Validation(); foreach ($param as $selectors) { $m = $f->collectKeys($keys, $selectors); if ($tempKeys === null) { $tempKeys = $m; } else { $tempKeys = array_intersect($tempKeys, $m); } } if ($tempKeys === null) { $tempKeys = array(); } return array('keys' => $tempKeys); }