コード例 #1
0
ファイル: post.php プロジェクト: richardHutchinson/ssl
    header("Location: http://localhost/websites/ssl/day7/main.php");
}
if (!isset($_SESSION["loggedin"])) {
    header("Location: http://localhost/websites/ssl/day7/main.php");
}
if (!empty($_GET["action"])) {
    if ($_GET["action"] == "getAll") {
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    } elseif ($_GET["action"] == "readPost") {
        $data = $posts->readPost($_GET["postId"]);
        $myview->getView("../views/blogPost.php", $data);
    } elseif ($_GET["action"] == "updatePost") {
        $data = $posts->readPost($_GET["postId"]);
        $myview->getView("../views/formUpdate.html", $data);
    } elseif ($_GET["action"] == "changePost") {
        $posts->updatePost($_POST["title"], $_POST["detail"], $_POST["postId"]);
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    } elseif ($_GET["action"] == "deletePost") {
        $posts->deletePost($_GET["postId"]);
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    } elseif ($_GET["action"] == "createPost") {
        $posts->createPost($_POST["title"], $_POST["detail"], $_SESSION["userId"]);
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    }
} elseif (empty($_GET["postId"])) {
    $myview->getView("../views/home.php", array());
}
コード例 #2
0
ファイル: post.php プロジェクト: richardHutchinson/ssl
if (!isset($_SESSION["loggedin"])) {
    header("Location: http://localhost/websites/ssl/day5/main.php");
} else {
    echo "banana (session set)";
}
if (!empty($_GET["action"])) {
    if ($_GET["action"] == "getAll") {
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    } elseif ($_GET["action"] == "readPost") {
        $data = $posts->readPost($_GET["postId"]);
        $myview->getView("../views/blogPost.php", $data);
    } elseif ($_GET["action"] == "updatePost") {
        $data = $posts->readPost($_GET["postId"]);
        $myview->getView("../views/formUpdate.html", $data);
    } elseif ($_GET["action"] == "changePost") {
        $posts->updatePost($_POST["title"], $_POST["detail"], $_POST["postId"]);
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    } elseif ($_GET["action"] == "deletePost") {
        $posts->deletePost($_GET["postId"]);
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    } elseif ($_GET["action"] == "createPost") {
        $posts->createPost($_POST["title"], $_POST["detail"]);
        $data = $posts->readPosts();
        $myview->getView("../views/body.php", $data);
    }
} elseif (empty($_GET["postId"])) {
    $myview->getView("../views/home.php", array());
}