Exemple #1
0
function tree($path, $n = 0)
{
    foreach (scandir($path) as $name) {
        if (canStop($n)) {
            return;
        }
        if ('.' === $name || '..' === $name) {
            continue;
        }
        $f = $path . DIRECTORY_SEPARATOR . $name;
        if (is_dir($f)) {
            displayDir($name, $n);
            tree($f, $n + 1);
        } else {
            displayFile($name, $n);
        }
    }
}
Exemple #2
0
<?php

// ログインフォームを表示します
require_once "lib_display.php";
error_reporting(E_ALL);
session_start();
// 置換する文字列を指定します
$strings = array("message", "email");
$replaces = array();
foreach ($strings as $string) {
    $replaces[$string] = isset($_SESSION[$string]) ? $_SESSION[$string] : null;
}
// login_form.phpを表示します
displayFile("login_form.html", $replaces, false, true);
// セッション情報を削除します
session_destroy();
Exemple #3
0
error_reporting(E_ALL);
session_start();
// ログインしていなければログインページに移動します
if (isLogin() == false) {
    header("location: login_form.php");
    exit;
}
// 日付がGETで受け取れているか判定します
// GETできていなければマイページに移動します
if (!isset($_GET["date"])) {
    $_SESSION["message"] = "日付が指定されていません";
    header("location: mypage.php");
    exit;
}
// 日記の情報を取得します
// 取得できなければマイページに移動します
$diary = getDiaryData($_SESSION["person_id"], $_GET["date"]);
if ($diary == false) {
    $_SESSION["message"] = "指定された日記は存在しません";
    header("location: mypage.php");
    exit;
}
// 日記の情報に置換する文字列を指定します
$strings = array("name", "create_day", "post");
$replaces = array();
foreach ($strings as $string) {
    $replaces[$string] = isset($diary[$string]) ? $diary[$string] : null;
}
// diary.phpを表示します
displayFile("diary.html", $replaces);
Exemple #4
0
<?php

require_once "../function/DB/Usersql.php";
require_once "../lib/MyTemplateEngine.php";
$items = array();
$DB = new DBUsersql();
$items["task_list"] = $DB->task->getAllTaskById("1");
$loop = array("2" => $items["task_list"]);
displayFile("index.html", null, false, $loop);
exit;
Exemple #5
0
<?php

// マイページを表示します
require_once "lib_DB.php";
require_once "lib_display.php";
require_once "lib_login.php";
error_reporting(E_ALL);
session_start();
// ログインしていなければログインページに移動します
if (isLogin() == false) {
    header("location: login_form.php");
    exit;
}
// セッションの値に置換する文字列を指定します
$strings = array("message", "name");
$replaces = array();
foreach ($strings as $string) {
    $replaces[$string] = isset($_SESSION[$string]) ? $_SESSION[$string] : null;
}
// 日記の情報を取得します
$diaries = getDiaryData($_SESSION["person_id"]);
// 日記の情報に繰り返し置換する行を指定します
$loop = array("4" => $diaries);
// mypage.htmlを表示します
displayFile("mypage.html", $replaces, $loop);
// メッセージを削除します
unset($_SESSION["message"]);
Exemple #6
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();
$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);
<?php

// 登録完了ページを表示します
error_reporting(E_ALL);
session_start();
require_once "lib_display.php";
require_once "lib_DB.php";
// register_finish.htmlを表示します
displayFile("register_finish.html");
// セッション情報を削除します
session_destroy();