Exemplo n.º 1
0
 protected function _login($username, $password, $remember)
 {
     $pwHash = "";
     do {
         $res = MyDB::loginStudent($username);
         $pwHash = $res['pwHash'];
         $type = 'student';
         if ($pwHash != "") {
             break;
         }
         $res = MyDB::loginCompany($username);
         $pwHash = $res['CompanyPass'];
         $type = 'company';
         if ($pwHash != "") {
             break;
         }
         $res = MyDB::loginAdmin($username);
         $pwHash = $res['Password'];
         $type = 'admin';
         if ($pwHash != "") {
             break;
         }
     } while ($pwHash == -1);
     //echo $pwHash." ".$this->hash($password.$username);
     if ($pwHash == $this->hash($password . $username)) {
         $session = Session::instance();
         $session->set('userType', $type);
         $session->set('userId', $res['id_pk']);
         return $this->complete_login($username);
     }
     return false;
 }