Advertisement
GWibisono

joomla pass logic

Apr 18th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. var $table='jos_users';
  2. /*
  3. Work on joomla 1.5
  4. */
  5. public function detail($id,$field='username'){
  6.         $sql=sprintf('select * from %s where %s="%s"',
  7.           $this->table, $field, $id);
  8.         return $this->resOne($sql ); //array (name,username,pass ...
  9.     }
  10.  
  11. public function checkUser($username,$password){
  12.         $data=$this->detail($username);
  13.         $pass=$data['password'];
  14.         $ar=explode(":",$pass);
  15.         $pass2=md5($password.$ar[1]).":".$ar[1] ;
  16.         $sql=sprintf("select count(id) c from %s where username='%s' and password='%s' and block=0",
  17.         $this->table, $username,$pass2);
  18.         $data=$this->resOne($sql,1);//array(c=>
  19.         return $data['c']==1?true:false;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement