Esempio n. 1
0
 private function loginNow($account, $newAccount = false)
 {
     $session = new BaseSession();
     $ip = $_SERVER['REMOTE_ADDR'];
     $userAgent = $_SERVER['HTTP_USER_AGENT'];
     if ($account['active'] == 'active') {
         $active = true;
     } else {
         $active = false;
     }
     $session->set(array('ip' => $ip, 'userName' => strtolower($account['username']), 'userAgent' => $userAgent, 'active' => $active));
     if ($this->accountModel->lastLogin($account['username'], $ip)) {
         if (isset($_SESSION['last-location'])) {
             header('Location:http://' . $_SERVER['HTTP_HOST'] . '/' . $_SESSION['last-location']);
             die;
         } else {
             header('Location:http://' . $_SERVER['HTTP_HOST'] . '/');
             die;
         }
     } else {
         $session->end();
         header('Location:http://' . $_SERVER['HTTP_HOST'] . '/');
         die;
     }
 }