$conditionalVariables['login_display_error'] = 'none'; } else { // Register a new user with form data $username = Database::Instance()->EscapeString($_POST['username']); $password = Database::Instance()->EscapeString($_POST['password']); $email = Database::Instance()->EscapeString($_POST['email']); $secondaryEmail = Database::Instance()->EscapeString($_POST['secondary_email']); if ($secondaryEmail == "") { $secondaryEmail = $email; } $planetName = Database::Instance()->EscapeString($_POST['planet_name']); if ($planetName == "") { $planetName = "Colony"; } // TODO: localize this? // Create new user, is automatically added to database $user = User::NewUser($username, $password, 0, $email, $secondaryEmail, $planetName); if ($user) { // Set this user as the current user. $user->SetAsCurrentUser(); $page = new Page("registration_complete", NULL, "Registration Complete", "account_activation"); echo $page->Display(); return; } else { // Display the page, with an error message $conditionalVariables['login_display_error'] = 'block'; } } $extraScripts = Helper::InsertValidation("../"); $page = new Page("registration", $conditionalVariables, "Register new account", "account_activation", $extraScripts); echo $page->Display();
<?php session_start(); echo "Hello World</br>"; echo "Register script in progress...</br>"; echo $_POST['name'] . "</br>"; echo $_POST['surname'] . "</br>"; echo $_POST['email'] . "</br>"; echo $_POST['password'] . "</br>"; echo $_POST['nick'] . "</br>"; include_once 'UserHandler.php'; if (isset($_POST['name']) && isset($_POST['surname']) && isset($_POST['email']) && isset($_POST['password']) && isset($_POST['nick'])) { $name = $_POST['name']; $surname = $_POST['surname']; $email = $_POST['email']; $nick = $_POST['nick']; $password = $_POST['password']; /*TODO: Check if user exists!!!*/ $user = User::NewUser($name, $surname, $email, $password, $nick); if ($user->isSaved()) { echo 'Reg successful!'; } else { echo 'Reg un-successful!'; } }
error_reporting(30719); require_once "common.php"; Database::Instance()->ExecuteQuery("TRUNCATE TABLE colony", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE colony_defences", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE colony_properties", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE colony_resources", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE colony_structures", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE fleet", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE user", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE production", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE user_officers", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE user_technology", NULL); Database::Instance()->ExecuteQuery("TRUNCATE TABLE scheduled_transports", NULL); Database::Instance()->SetDebugging(true); $user = User::NewUser("Beerdude26", "aSimplePassword", 100, "*****@*****.**", "alternate_email"); $colony = Colony::NewColony("Nigron", new Coordinates(100, 50, 7), $user, FALSE); Colony::AddToDatabase($colony); echo "<br/>"; echo "<br/>"; echo "Current colony:"; Helper::var_dump_pre($user->CurrentColony()->ID()); $units = array("light_fighter" => 10, "small_cargo_ship" => 20, "cruiser" => 10); $extrafleet = ShipFleet::FromList($units, $user->CurrentColony(), 0); //Helper::var_dump_pre( $user->CurrentColony()->Fleet() ); echo "Adding some extra units to original fleet: "; $user->CurrentColony()->Fleet()->AddToFleet($extrafleet); $user->CurrentColony()->Fleet()->UpdateDatabase(); $t_units = array("light_fighter" => 5, "small_cargo_ship" => 5, "cruiser" => 3); $t_fleet = ShipFleet::FromList($t_units, $user->CurrentColony(), 0); echo "Splitting up some units from the original fleet: ";