コード例 #1
0
ファイル: newcity.php プロジェクト: kitwistful/CityBuilder
?>
    <title>Create City in City Builder</title>
</head>
<body>
<?php 
include "../scripts/CityData.php";
$username = $_SESSION["citybuilder_username"];
if (!$_SESSION["citybuilder_bLoggedIn"] || $username == null) {
    echo "ERROR: not logged in<br />";
}
// form validation
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // get form info
    $cityname = CityBuilder::validateInput($_POST["cityname"], false);
    // create city
    $message = CityData::addCity($cityname, $username, 2000, 0);
    if ($message != null) {
        echo "ERROR: {$message}<br />";
    } else {
        echo "Successfully created '{$cityname}'<br />";
    }
}
define("CURRENT_PAGE", "../pages/newcity.php");
include "../scripts/header.php";
?>

    <article>
        <header>Create City</header>
        <content>
            Let's make a city!
            <form action = "newcity.php" method = "POST">