<?php require "../includes/config.php"; if (!empty($_POST["campname"])) { $_SESSION["campaign"] = $_POST["campname"]; } if (!empty($_POST["storyname"])) { $_SESSION["storyline"] = $_POST["storyname"]; } if (empty($_SESSION["campaign"])) { spawn("camp_select.php"); } else { if (empty($_SESSION["storyline"])) { spawn("camp_story_select.php"); } else { spawn("camp_display.php"); } }
<?php require "../includes/config.php"; spawn("index_template.php");
// establish connection to server $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } else { echo "successful connection"; } // prepare and bind $stmt = $conn->prepare("INSERT INTO users (realname, email, username, userpass) VALUES (?, ?, ?, ?)"); $stmt->bind_param("ssss", $realname, $email, $username, $userpass); // set parameters and execute $realname = htmlspecialchars($_POST["realname"]); $email = htmlspecialchars($_POST["email"]); $username = htmlspecialchars($_POST["username"]); $userpass = $_POST["userpass"]; $stmt->execute(); // close the statement $stmt->close(); // try to log in the new user // close the connection $conn->close(); // spawn register_complete.php spawn("register_complete.php"); } } } } } } }
while ($stmt->fetch()) { // fetch the // compare password on file to POST password if ($col5 == $_POST["userpass"]) { // identified the user //echo "user found!"; // remember the user in SESSION $_SESSION["id"] = $col1; // remember the username for later $_SESSION["username"] = $col3; $check = 1; } else { echo "could not log in user"; } } // close the statement $stmt->close(); // try to log in the new user // close the connection $conn->close(); } } if ($check == 1) { // spawn the log in complete template spawn("login_complete.php"); } else { // spawn the log in failed templatew spawn("login_failed.php"); } } }
<?php require "../includes/config.php"; if (empty($_SESSION["username"])) { redirect("/public/login.php"); } else { if (empty($_SESSION["campaign"])) { redirect("/public/campaign.php"); } else { if (empty($_SESSION["storyline"])) { redirect("/public/campaign.php"); } else { spawn("comment_template.php"); } } }
{ protected static $cnt = 0; private $id; public static function getCount() { return static::$cnt; } public function __construct() { parent::__construct(); $this->id = self::$cnt++; echo 'Daughter #' . $this->id . PHP_EOL; } } function spawn() { $rand = rand(1, 15); $rand2 = rand(1, 15); for ($x = 0; $x < $rand; $x++) { $a[] = new MySon(); } for ($x = 0; $x < $rand2; $x++) { $b[] = new MyDaughter(); } // for($x=0; $x<sizeof($a)+sizeof($b);$x++) } spawn(); echo 'Il y a ' . MyClass::getCount() . ' instance de myClass' . PHP_EOL; echo 'Il y a ' . MyDaughter::getCount() . ' instance de myDaughter' . PHP_EOL; echo 'Il y a ' . MySon::getCount() . ' instance de mySon' . PHP_EOL; //echo 'Il y a ' . MyClass::getCount() . ' instance de myClass' . PHP_EOL;