本文整理匯總了PHP中Framework::Redir方法的典型用法代碼示例。如果您正苦於以下問題:PHP Framework::Redir方法的具體用法?PHP Framework::Redir怎麽用?PHP Framework::Redir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Framework
的用法示例。
在下文中一共展示了Framework::Redir方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
public function init()
{
// check if logged in session is valid, if not redir to main page
if (!isset($_SESSION['loginHash'])) {
Framework::Redir("site/index");
die;
}
$activeSession = R::findOne('session', ' hash = ? AND ip = ? AND expires > ?', array($_SESSION['loginHash'], $_SERVER['REMOTE_ADDR'], time()));
if (!$activeSession) {
unset($_SESSION['loginHash']);
Framework::Redir("site/index/main/session_expired");
die;
}
$activeSession->expires = time() + SESSION_MAX_AGE * 2;
R::store($activeSession);
$this->session = $activeSession;
$this->user = R::load('user', $this->session->user->getId());
Framework::TPL()->assign('user_premium', $this->user->hasPremium());
// check needed rights if any
foreach ($this->_rights as $r) {
if (!$this->user->hasRight($r)) {
Framework::Redir("game/index");
die;
}
}
}
示例2: show_Activate
public function show_Activate()
{
$aHash = $this->get(1);
$user = R::findOne('user', ' activation_code = ?', array($aHash));
if (!$user) {
echo "Ungültiger Aktivierungscode";
exit;
}
$user->activation_code = '';
$user->is_active = true;
R::store($user);
Framework::Redir("site/index/main/login");
}
示例3: switchTable
private function switchTable()
{
if (isset($_POST['switchTable'])) {
$_SESSION['currentTable'] = $_POST['switchTable'];
Framework::Redir("game/db_admin");
}
if (!isset($_SESSION['currentTable']) || !in_array($_SESSION['currentTable'], array_keys($this->dbTables))) {
$_SESSION['currentTable'] = 'map_object';
}
$this->currentTable = $_SESSION['currentTable'];
Framework::TPL()->assign('currentTable', $this->currentTable);
Framework::TPL()->assign('dbTables', $this->dbTables);
}