/** * Attempts a login * * @param $username * * @param $password * * @return bool */ public function Attempt($username, $password) { /** * Lets get our userid */ $user_id = $this->user->ToUserID($username); /** * Is our userID null? */ if ($user_id == null) { $this->AddError('The information you have entered is invalid.'); return false; } /** * If not, lets create a new class */ $user = $this->user->ToClass($user_id); /** * Is this user allowed to attempt to login to this user_id? */ if ($this->securelogin->AllowAttempt($user_id, $this->GetAddress()) == false) { $this->AddError('You have been banned from attempting a login for 15 minutes.'); return false; } /** * Lets now match all of our data */ if ($user != null) { /** * Lets go ahead and hash our password */ $hashed_password = $this->HashPassword($password, $user->GetSalt()); /** * Check */ if ($hashed_password == $user->GetPassword()) { /** * Create a new session. */ $this->session->Create($user_id); /** * Return true */ return true; } /** * Else wrong password */ $this->AddError('The information you have entered is invalid.'); /** * Add an attempt */ $this->securelogin->AddAttempt($user_id, $this->GetAddress()); /** * Return false. */ return false; } /** * Information invalid */ $this->AddError('The information you have entered is invalid.'); return false; }
function show() { $userData = $this->_activeUser(); Session::Create($userData['userID'], $userData['planetID']); HTTP::redirectTo('game.php'); }
} $message = $i * 2; $message = $message . "%"; switch ($i) { case 1: $database->DropTables(); break; case 2: $user = new User(); $user->SetDatabase($database); $user->Create(); break; case 3: $session = new Session(); $session->SetDatabase($database); $session->Create(); break; case 4: $area = new Area(); $area->SetDatabase($database); $area->Create(); break; case 5: $subject = new Subject(); $subject->SetDatabase($database); $subject->Create(); break; case 6: $article = new Article(); $article->SetDatabase($database); $article->Create();