Jeff PHP framework
0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
|
00001 <?php 00029 class user extends model { 00030 00036 function __construct($id) { 00037 00038 $this->_tbl_data = TBL_USERS; 00039 00040 parent::__construct($id); 00041 00042 } 00043 00050 public static function get($opts = array()) { 00051 00052 $registry = registry::instance(); 00053 00054 $objs = array(); 00055 $rows = $registry->db->autoSelect("id", TBL_USERS, '', 'lastname'); 00056 foreach($rows as $row) $objs[] = new user($row['id']); 00057 00058 return $objs; 00059 00060 } 00061 00069 public static function getFromAuth($user, $pwd) { 00070 00071 $registry = registry::instance(); 00072 00073 if(PWD_HASH=='md5') $pwd_check = md5($pwd); 00074 elseif(PWD_HASH=='sha1') $pwd_check = sha1($pwd); 00075 else $pwd_check = $pwd; 00076 00077 $qr = $registry->db->autoSelect(array("id"), array(TBL_USERS), "username='$user' AND password='".$pwd_check."'", null); 00078 00079 return count($qr) ? new user($qr[0]['id']):null; 00080 00081 00082 } 00083 00084 } 00085 00086 ?>