Пример #1
0
 /**
  * Login
  * Layout for the Login page for the site, called when a user
  * does not have adequate permissions to view the standard news page.
  */
 public function Login()
 {
     if (lib\Session::isLoggedIn()) {
         header('Location: ' . WEB_URL . "/");
     } else {
         $params = array("WEB_NAME_ABBR" => WEB_NAME_ABBR, "SHOW_ERROR" => "hidden", "WEB_URL" => WEB_URL);
         // Check to see if User is attempting to
         // Login to the site
         if (isset($_POST['username'])) {
             $user = new lib\User();
             if ($user->validateByLogin($_POST['username'], $_POST['password'], $_POST['remember'])) {
                 header('Location: ' . WEB_URL . '/');
             } else {
                 $params['SHOW_ERROR'] = '';
                 $params['ERROR'] = 'Your Login Credentials are Invalid. Please try again!';
             }
             $params["USERNAME"] = $_POST['username'];
         }
         $this->renderView("home" . DS . "HomeLogin.tpl", $params, false);
     }
 }
Пример #2
0
 /**
  * Update current group the user is accessing
  * in both the session and then the database
  * for their user ID
  */
 public static function updateGroup($groupID)
 {
     if (self::isLoggedIn()) {
         if ($groupID != $_SESSION[SESSION_NAME]["GROUP"]) {
             if (isset($_SESSION[SESSION_NAME]["GROUPS"][$groupID])) {
                 $_SESSION[SESSION_NAME]["GROUP"] = $groupID;
                 $user = new User();
                 $user->updateGroup($groupID, $_SESSION[SESSION_NAME]["ID"]);
                 return true;
             }
         }
     }
     return false;
 }