Advertisement
farikariyanto

user

Oct 22nd, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <?php
  2. Class User extends CI_Model
  3. {
  4.     function login($username, $password)
  5.     {
  6.         $this -> db -> select('id, username, password');
  7.         $this -> db -> from('users');
  8.         $this -> db -> where('username = ' . "'" . $username . "'");
  9.         $this -> db -> where('password = ' . "'" . $password . "'");
  10.         $this -> db -> limit(1);
  11.  
  12.         $query = $this -> db -> get();
  13.  
  14.         if($query -> num_rows() == 1)
  15.         {
  16.             return $query->result();
  17.         }
  18.         else
  19.         {
  20.             return false;
  21.         }
  22.  
  23.     }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement