Next4Me
 All Data Structures Files Functions Variables
application/models/users.php
Go to the documentation of this file.
00001 <?php
00012 class Users extends Zend_Db_Table_Abstract{
00013         
00014         protected $_name="UserAccounts"; 
00015         protected $_primary="IdUser"; 
00016         //==== Start doLogin =========================================================================
00026         function doLogin($username, $password, $chanel){
00027             
00028                 $sql = $this->fetchRow($this->select()->setIntegrityCheck(false)
00029                                             ->from("UserAccounts","*")
00030                                             ->where("UserName like binary ?",$username)
00031                                             ->where("Password like binary ?",$password)
00032                                             ->where("Active=1")
00033                                             ->where("UserAccount_Type=0")
00034                                             );
00035                                                                                           
00036                 if(isset($sql->IdUser)){
00037                     $idUser=$sql->IdUser;
00038                 }else{
00039                     $idUser=0;
00040                 }
00041                 if($idUser>0){
00042                         $response = array("resultId"=>"0","resultCode"=>array("token"=>md5("sec_t".$idUser."t3xt".microtime()),"IdUser"=>$idUser));    
00043                 }else{
00044                         $response = array("restultId"=>"1","resultCode"=>"Invalid username or password.");       
00045                 }
00046                 
00047                 return $response;
00048                                                                                           
00049         }
00050         //==== End doLogin =========================================================================
00051         function getUser($IdUser){
00052                 $sql = $this->fetchRow($this->select()->setIntegrityCheck(false)
00053                                             ->from("UserAccounts","*")
00054                                             ->where("IdUser=?",$IdUser)
00055                                             );
00056                 return $sql;
00057                                                                                           
00058         }    
00059         
00060         
00061         
00062            
00063 }