Ejemplo n.º 1
0
<?php

// 会員登録フォームを表示します
error_reporting(E_ALL);
session_start();
require_once "lib_display.php";
require_once "lib_DB.php";
// 選択できる年月日を指定します
for ($i = 1960; $i <= 2000; $i++) {
    $year[] = array("year" => $i);
}
for ($i = 1; $i <= 12; $i++) {
    $month[] = array("month" => $i);
}
for ($i = 1; $i <= 31; $i++) {
    $day[] = array("day" => $i);
}
// 都道府県情報を取得します
$prefectures = getPrefecture();
// 置換して繰り返す行を指定します
$loop = array("17" => $year, "20" => $month, "23" => $day, "28" => $prefectures);
// register.htmlを表示します
displayFile("register.html", null, $loop);
// セッション情報を削除します
session_destroy();
Ejemplo n.º 2
0
// 会員情報がすべてPOSTされているか確認します
$strings = array("last_name", "first_name", "last_kana", "first_kana", "gender_id", "year", "month", "day", "prefecture_code", "email", "password", "re_password");
// POSTされていない項目があれば登録フォームに移動します
foreach ($strings as $string) {
    if (empty($_POST[$string])) {
        header("location: register.php");
        exit;
    }
}
// 会員登録できるか確認します
// できなければ登録フォームに移動します
if (false == checkRegister($_POST["email"], $_POST["password"], $_POST["re_password"])) {
    $_SESSION["message"] = "";
    header("location: register.php");
    exit;
}
// 入力された会員情報をセッションに保存します
foreach ($strings as $string) {
    $_SESSION[$string] = $_POST[$string];
}
$_SESSION["birthday"] = $_POST["year"] . "-" . $_POST["month"] . "-" . $_POST["day"];
// 確認ページの表示用に文字列を置換します
$replaces = array();
foreach ($strings as $string) {
    $replaces[$string] = $_POST[$string];
}
$replaces["gender"] = getGender($_POST["gender_id"]);
$replaces["prefecture_name"] = getPrefecture($_POST["prefecture_code"]);
$replaces["password_msk"] = str_pad("", strlen($_POST["password"]), "*");
// register_check.htmlを表示します
displayFile("register_check.html", $replaces);