public function main() { WoW_Template::SetPageIndex('login'); if (WoW_Account::IsLoggedIn()) { header('Location: ' . WoW::GetWoWPath() . '/'); exit; } if (isset($_POST['accountName'])) { $username = $_POST['accountName']; $password = $_POST['password']; $persistLogin = isset($_POST['persistLogin']) ? true : false; WoW_Account::DropLastErrorCode(); if (mb_strlen($password) <= 7) { WoW_Account::SetLastErrorCode(ERORR_INVALID_PASSWORD_FORMAT); } if ($username == null) { WoW_Account::SetLastErrorCode(ERROR_EMPTY_USERNAME); } if ($password == null) { WoW_Account::SetLastErrorCode(ERROR_EMPTY_PASSWORD); } if (WoW_Account::PerformLogin($username, $password, $persistLogin)) { if (isset($_POST['ref'])) { header('Location: ' . $_POST['ref']); exit; } header('Location: ' . WoW::GetWoWPath() . '/'); exit; } // Other error messages will appear automaticaly. } WoW_Template::LoadTemplate('page_login', true); }