当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP::redirectToUniverse方法代码示例

本文整理汇总了PHP中HTTP::redirectToUniverse方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::redirectToUniverse方法的具体用法?PHP HTTP::redirectToUniverse怎么用?PHP HTTP::redirectToUniverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTP的用法示例。


在下文中一共展示了HTTP::redirectToUniverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Language

 if (empty($USER)) {
     HTTP::redirectTo('index.php?code=3');
 }
 $LNG = new Language($USER['lang']);
 $LNG->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
 $THEME->setUserTheme($USER['dpath']);
 if ($config->game_disable == 0 && $USER['authlevel'] == AUTH_USR) {
     ShowErrorPage::printError($LNG['sys_closed_game'] . '<br><br>' . $config->close_reason, false);
 }
 if ($USER['bana'] == 1) {
     ShowErrorPage::printError("<font size=\"6px\">" . $LNG['css_account_banned_message'] . "</font><br><br>" . sprintf($LNG['css_account_banned_expire'], _date($LNG['php_tdformat'], $USER['banaday'], $USER['timezone'])) . "<br><br>" . $LNG['css_goto_homeside'], false);
 }
 if (MODE === 'INGAME') {
     $universeAmount = count(Universe::availableUniverses());
     if (Universe::current() != $USER['universe'] && $universeAmount > 1) {
         HTTP::redirectToUniverse($USER['universe']);
     }
     $session->selectActivePlanet();
     $sql = "SELECT * FROM %%PLANETS%% WHERE id = :planetId;";
     $PLANET = $db->selectSingle($sql, array(':planetId' => $session->planetId));
     if (empty($PLANET)) {
         $sql = "SELECT * FROM %%PLANETS%% WHERE id = :planetId;";
         $PLANET = $db->selectSingle($sql, array(':planetId' => $USER['id_planet']));
         if (empty($PLANET)) {
             throw new Exception("Main Planet does not exist!");
         } else {
             $session->planetId = $USER['id_planet'];
         }
     }
     $USER['factor'] = getFactors($USER);
     $USER['PLANETS'] = getPlanets($USER);
开发者ID:bergi9,项目名称:2Moons,代码行数:31,代码来源:common.php

示例2: defineCurrentUniverse

 /**
  * Find current universe id using cookies, get parameter or session keys.
  *
  * @return int
  */
 private static function defineCurrentUniverse()
 {
     $universe = NULL;
     if (MODE === 'INSTALL') {
         // Installer are always in the first universe.
         return ROOT_UNI;
     }
     if (count(self::availableUniverses()) != 1) {
         if (MODE == 'LOGIN') {
             if (isset($_COOKIE['uni'])) {
                 $universe = (int) $_COOKIE['uni'];
             }
             if (isset($_REQUEST['uni'])) {
                 $universe = (int) $_REQUEST['uni'];
             }
         } elseif (MODE == 'ADMIN' && isset($_SESSION['admin_uni'])) {
             $universe = (int) $_SESSION['admin_uni'];
         }
         if (is_null($universe)) {
             if (UNIS_WILDCAST === true) {
                 $temp = explode('.', $_SERVER['HTTP_HOST']);
                 $temp = substr($temp[0], 3);
                 if (is_numeric($temp)) {
                     $universe = $temp;
                 } else {
                     $universe = ROOT_UNI;
                 }
             } else {
                 if (isset($_SERVER['REDIRECT_UNI'])) {
                     // Apache - faster then preg_match
                     $universe = $_SERVER["REDIRECT_UNI"];
                 } elseif (isset($_SERVER['REDIRECT_REDIRECT_UNI'])) {
                     // Patch for www.top-hoster.de - Hoster
                     $universe = $_SERVER["REDIRECT_REDIRECT_UNI"];
                 } elseif (preg_match('!/uni([0-9]+)/!', HTTP_PATH, $match)) {
                     if (isset($match[1])) {
                         $universe = $match[1];
                     }
                 } else {
                     $universe = ROOT_UNI;
                 }
                 if (!isset($universe) || !self::exists($universe)) {
                     HTTP::redirectToUniverse(ROOT_UNI);
                 }
             }
         }
     } else {
         if (HTTP_ROOT != HTTP_BASE) {
             HTTP::redirectTo(PROTOCOL . HTTP_HOST . HTTP_BASE . HTTP_FILE, true);
         }
         $universe = ROOT_UNI;
     }
     return $universe;
 }
开发者ID:bergi9,项目名称:2Moons,代码行数:59,代码来源:Universe.class.php


注:本文中的HTTP::redirectToUniverse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。