本文整理汇总了PHP中HTTP::redirectTo方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::redirectTo方法的具体用法?PHP HTTP::redirectTo怎么用?PHP HTTP::redirectTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP
的用法示例。
在下文中一共展示了HTTP::redirectTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
if (empty($_POST)) {
HTTP::redirectTo('index.php');
}
$db = Database::get();
$username = HTTP::_GP('username', '', UTF8_SUPPORT);
$password = HTTP::_GP('password', '', true);
$sql = "SELECT id, password FROM %%USERS%% WHERE universe = :universe AND username = :username;";
$loginData = $db->selectSingle($sql, array(':universe' => Universe::current(), ':username' => $username));
if (isset($loginData)) {
$hashedPassword = PlayerUtil::cryptPassword($password);
if ($loginData['password'] != $hashedPassword) {
// Fallback pre 1.7
if ($loginData['password'] == md5($password)) {
$sql = "UPDATE %%USERS%% SET password = :hashedPassword WHERE id = :loginID;";
$db->update($sql, array(':hashedPassword' => $hashedPassword, ':loginID' => $loginData['id']));
} else {
HTTP::redirectTo('index.php?code=1');
}
}
$session = Session::create();
$session->userId = (int) $loginData['id'];
$session->adminAccess = 0;
$session->save();
HTTP::redirectTo('game.php');
} else {
HTTP::redirectTo('index.php?code=1');
}
}
示例2: ShowMultiIPPage
function ShowMultiIPPage()
{
global $LNG;
switch ($_GET['action']) {
case 'known':
$GLOBALS['DATABASE']->query("INSERT INTO " . MULTI . " SET userID = " . (int) $_GET['id'] . ";");
HTTP::redirectTo("admin.php?page=multiips");
break;
case 'unknown':
$GLOBALS['DATABASE']->query("DELETE FROM " . MULTI . " WHERE userID = " . (int) $_GET['id'] . ";");
HTTP::redirectTo("admin.php?page=multiips");
break;
}
$Query = $GLOBALS['DATABASE']->query("SELECT id, username, email, register_time, onlinetime, user_lastip, IFNULL(multiID, 0) as isKnown FROM " . USERS . " LEFT JOIN " . MULTI . " ON userID = id WHERE `universe` = '" . Universe::getEmulated() . "' AND user_lastip IN (SELECT user_lastip FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "' GROUP BY user_lastip HAVING COUNT(*)>1) ORDER BY user_lastip, id ASC;");
$IPs = array();
while ($Data = $GLOBALS['DATABASE']->fetch_array($Query)) {
if (!isset($IPs[$Data['user_lastip']])) {
$IPs[$Data['user_lastip']] = array();
}
$Data['register_time'] = _date($LNG['php_tdformat'], $Data['register_time']);
$Data['onlinetime'] = _date($LNG['php_tdformat'], $Data['onlinetime']);
$IPs[$Data['user_lastip']][$Data['id']] = $Data;
}
$template = new template();
$template->assign_vars(array('multiGroups' => $IPs));
$template->show('MultiIPs.tpl');
}
示例3: show
function show()
{
$method = HTTP::_GP('method', '');
$method = strtolower(str_replace(array('_', '\\', '/', '.', ""), '', $method));
$path = 'includes/classes/extauth/' . $method . '.class.php';
if (!file_exists($path)) {
HTTP::redirectTo('index.php');
}
$session = Session::create();
require 'includes/classes/extauth/externalAuth.interface.php';
require $path;
$methodClass = ucwords($method) . 'Auth';
/** @var $authObj externalAuth */
$authObj = new $methodClass();
if (!$authObj->isActiveMode()) {
$session->delete();
$this->redirectTo('index.php?code=5');
}
if (!$authObj->isValid()) {
$session->delete();
$this->redirectTo('index.php?code=4');
}
$loginData = $authObj->getLoginData();
if (empty($loginData)) {
$session->delete();
$this->redirectTo('index.php?page=register&externalAuth[account]=' . $authObj->getAccount() . '&externalAuth[method]=facebook');
}
$session->userId = (int) $loginData['id'];
$session->adminAccess = 0;
$session->save();
$this->redirectTo("game.php");
}
示例4: send
function send()
{
global $USER, $LNG;
$ticketID = HTTP::_GP('id', 0);
$message = HTTP::_GP('message', '', true);
$change = HTTP::_GP('change_status', 0);
$ticketDetail = $GLOBALS['DATABASE']->getFirstRow("SELECT ownerID, subject, status FROM " . TICKETS . " WHERE ticketID = " . $ticketID . ";");
$status = $change ? $ticketDetail['status'] <= 1 ? 2 : 1 : 1;
if (!$change && empty($message)) {
HTTP::redirectTo('admin.php?page=support&mode=view&id=' . $ticketID);
}
$subject = "RE: " . $ticketDetail['subject'];
if ($change && $status == 1) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $LNG['ti_admin_open'], $status);
}
if (!empty($message)) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $message, $status);
}
if ($change && $status == 2) {
$this->ticketObj->createAnswer($ticketID, $USER['id'], $USER['username'], $subject, $LNG['ti_admin_close'], $status);
}
$subject = sprintf($LNG['sp_answer_message_title'], $ticketID);
$text = sprintf($LNG['sp_answer_message'], $ticketID);
PlayerUtil::sendMessage($ticketDetail['ownerID'], $USER['id'], $USER['username'], 4, $subject, $text, TIMESTAMP, NULL, 1, Universe::getEmulated());
HTTP::redirectTo('admin.php?page=support');
}
示例5: show
function show()
{
$userData = $this->_activeUser();
$session = Session::create();
$session->userId = (int) $userData['userID'];
$session->adminAccess = 0;
$session->save();
HTTP::redirectTo('game.php');
}
示例6: register
function register()
{
$uid = $this->getAccount();
$me = $this->api('/me');
$ValidReg = $GLOBALS['DATABASE']->getFirstCell("SELECT cle FROM " . USERS_VALID . " WHERE universe = " . $UNI . " AND email = '" . $GLOBALS['DATABASE']->sql_escape($me['email']) . "';");
if (!empty($ValidReg)) {
HTTP::redirectTo("index.php?uni=" . $UNI . "&page=reg&action=valid&clef=" . $ValidReg);
}
$GLOBALS['DATABASE']->query("INSERT INTO " . USERS_AUTH . " SET\n\t\tid = (SELECT id FROM " . USERS . " WHERE email = '" . $GLOBALS['DATABASE']->sql_escape($me['email']) . "' OR email_2 = '" . $GLOBALS['DATABASE']->sql_escape($me['email']) . "'),\n\t\taccount = " . $uid . ",\n\t\tmode = 'facebook';");
}
示例7: single
function single()
{
global $LNG;
$LNG->includeData(array('FAQ'));
$categoryID = HTTP::_GP('categoryID', 0);
$questionID = HTTP::_GP('questionID', 0);
if (!isset($LNG['questions'][$categoryID][$questionID])) {
HTTP::redirectTo('game.php?page=questions');
}
$this->assign(array('questionRow' => $LNG['questions'][$categoryID][$questionID]));
$this->display('page.questions.single.tpl');
}
示例8: ShowLoginPage
function ShowLoginPage()
{
global $USER, $LNG;
if (isset($_REQUEST['admin_pw'])) {
$password = cryptPassword($_REQUEST['admin_pw']);
if ($password == $USER['password']) {
$_SESSION['admin_login'] = $password;
HTTP::redirectTo('admin.php');
}
}
$template = new template();
$template->assign_vars(array('bodyclass' => 'standalone', 'username' => $USER['username']));
$template->show('LoginPage.tpl');
}
示例9: getUniverse
function getUniverse()
{
$gameConfig = Config::getAll(NULL);
if (MODE == 'ADMIN' && isset($_SESSION['adminuni'])) {
$UNI = (int) $_SESSION['adminuni'];
} elseif (MODE == 'LOGIN') {
if (isset($_COOKIE['uni'])) {
$UNI = (int) $_COOKIE['uni'];
}
if (isset($_REQUEST['uni'])) {
$UNI = (int) $_REQUEST['uni'];
}
}
if (!isset($UNI)) {
if (UNIS_WILDCAST === true) {
$UNI = explode('.', $_SERVER['HTTP_HOST']);
$UNI = substr($UNI[0], 3);
if (!is_numeric($UNI)) {
$UNI = ROOT_UNI;
}
} else {
if (count($gameConfig) == 1) {
if (HTTP_ROOT != HTTP_BASE) {
HTTP::redirectTo(PROTOCOL . HTTP_HOST . HTTP_BASE . HTTP_FILE, true);
}
$UNI = ROOT_UNI;
} else {
if (isset($_SERVER['REDIRECT_UNI'])) {
// Apache - faster then preg_match
$UNI = $_SERVER["REDIRECT_UNI"];
} elseif (isset($_SERVER['REDIRECT_REDIRECT_UNI'])) {
// Patch for www.top-hoster.de - Hoster
$UNI = $_SERVER["REDIRECT_REDIRECT_UNI"];
} elseif (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache/') === false) {
preg_match('!/uni([0-9]+)/!', HTTP_PATH, $match);
if (isset($match[1])) {
$UNI = $match[1];
}
}
if (!isset($UNI) || !isset($gameConfig[$UNI])) {
HTTP::redirectTo(PROTOCOL . HTTP_HOST . HTTP_BASE . "uni" . ROOT_UNI . "/" . HTTP_FILE, true);
}
}
}
}
return $UNI;
}
示例10: register
public function register()
{
$uid = $this->getAccount();
$me = $this->fbObj->api('/me');
$sql = 'SELECT validationID, validationKey FROM %%USERS_VALID%%
WHERE universe = :universe AND email = :email;';
$registerData = Database::get()->selectSingle($sql, array(':universe' => Universe::current(), ':email' => $me['email']));
if (!empty($registerData)) {
$url = sprintf('index.php?uni=%s&page=reg&action=valid&i=%s&validationKey=%s', Universe::current(), $registerData['validationID'], $registerData['validationKey']);
HTTP::redirectTo($url);
}
$sql = 'INSERT INTO %%USERS_AUTH." SET
id = (SELECT id FROM %%USERS%% WHERE email = :email OR email_2 = :email),
account = :accountId
mode = :mode;';
Database::get()->insert($sql, array(':email' => $me['email'], ':accountId' => $uid, ':mode' => 'facebook'));
}
示例11: ShowLoginPage
function ShowLoginPage()
{
global $USER;
$session = Session::create();
if ($session->adminAccess == 1) {
HTTP::redirectTo('admin.php');
}
if (isset($_REQUEST['admin_pw'])) {
$password = PlayerUtil::cryptPassword($_REQUEST['admin_pw']);
if ($password == $USER['password']) {
$session->adminAccess = 1;
HTTP::redirectTo('admin.php');
}
}
$template = new template();
$template->assign_vars(array('bodyclass' => 'standalone', 'username' => $USER['username']));
$template->show('LoginPage.tpl');
}
示例12: register
public function register()
{
$uid = $this->getAccount();
$user = $this->oidObj->getAttributes();
if (empty($user['contact/email'])) {
HTTP::redirectTo('index.php?code=4');
}
$sql = 'SELECT validationID, validationKey FROM %%USERS_VALID%%
WHERE universe = :universe AND email = :email;';
$registerData = Database::get()->selectSingle($sql, array(':universe' => Universe::current(), ':email' => $user['contact/email']));
if (!empty($registerData)) {
$url = sprintf('index.php?uni=%s&page=reg&action=valid&i=%s&validationKey=%s', Universe::current(), $registerData['validationID'], $registerData['validationKey']);
HTTP::redirectTo($url);
}
$sql = 'INSERT INTO %%USERS_AUTH%% SET
id = (SELECT id FROM %%USERS%% WHERE email = :email OR email_2 = :email),
account = :accountId
mode = :mode;';
Database::get()->insert($sql, array(':email' => $user['contact/email'], ':accountId' => $uid, ':mode' => $this->oidObj->identity));
}
示例13: show
function show()
{
$method = HTTP::_GP('method', '');
$method = strtolower(str_replace(array('_', '\\', '/', '.', ""), '', $method));
if (!file_exists('includes/extauth/' . $method . '.class.php')) {
HTTP::redirectTo('index.php');
}
Session::init();
require 'includes/extauth/' . $method . '.class.php';
$methodClass = ucwords($method) . 'Auth';
$authObj = new $methodClass();
if (!$authObj->isActiveMode()) {
$this->redirectTo('index.php?code=5');
}
if (!$authObj->isVaild()) {
$this->redirectTo('index.php?code=4');
}
$loginData = $authObj->getLoginData();
if (empty($loginData)) {
$this->redirectTo('index.php?page=register&externalAuth[account]=' . $authObj->getAccount() . '&externalAuth[method]=facebook');
}
Session::create($loginData['id'], $loginData['id_planet']);
$this->redirectTo("game.php");
}
示例14: getLoginData
function getLoginData()
{
global $UNI;
try {
$user = $this->getAttributes();
} catch (FacebookApiException $e) {
HTTP::redirectTo('index.php?code=4');
}
return $GLOBALS['DATABASE']->getFirstRow("SELECT \n\t\tuser.id, user.username, user.dpath, user.authlevel, user.id_planet \n\t\tFROM " . USERS_AUTH . " auth \n\t\tINNER JOIN " . USERS . " user ON auth.id = user.id AND user.universe = " . $UNI . "\n\t\tWHERE auth.account = '" . $user['contact/email'] . "' AND mode = '" . $GLOBALS['DATABASE']->sql_escape($_REQUEST['openid_identifier']) . "';");
}
示例15: redirectCode
static function redirectCode($Code)
{
HTTP::redirectTo('index.php?code=' . $Code);
}