Example #1
0
 public function getUser($username, $password, $isSHA = false)
 {
     if ($password == ";;;-1;;;") {
         return null;
     }
     $user = $this->getAppServerUser($username, !$isSHA ? sha1($password) : $password);
     if ($user != null) {
         return $user;
     }
     $user = LoginAD::getUser($username, $password);
     if ($user != null) {
         return $user;
     }
     $this->addAssocV3("username", "=", $username);
     if (!$isSHA) {
         $this->addAssocV3("SHApassword", "=", sha1($password), "AND", "1");
     } else {
         $this->addAssocV3("SHApassword", "=", $password, "AND", "1");
     }
     $this->addAssocV3("password", "=", $password, "OR", "1");
     $this->addAssocV3("UserType", "=", "0");
     $user = $this->getNextEntry();
     if ($user != null) {
         return $user;
     }
     try {
         if (isset($_SESSION["viaInterface"]) and $_SESSION["viaInterface"] and !class_exists("mphynxAltLogin")) {
             throw new Exception();
         }
         $AL = new mphynxAltLogin();
         $AL->addAssocV3("username", "=", $username);
         if (!$isSHA) {
             $AL->addAssocV3("SHApassword", "=", sha1($password), "AND", "1");
         } else {
             $AL->addAssocV3("SHApassword", "=", $password, "AND", "1");
         }
         $user = $AL->getNextEntry();
         if ($user != null) {
             return $user;
         }
     } catch (Exception $e) {
         return null;
     }
     return null;
 }