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
0
 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
0
 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);
 }