Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1.  public function admin_login_data_check()
  2.     {
  3.              $username = $this->input->post('username');
  4.              $password = md5($this->input->post('password'));
  5.              $role = $this->input->post('role');
  6.  
  7.    
  8.            
  9.  
  10.             $attribute = array(
  11.  
  12.                 'username' => $username,
  13.                 'password' => $password,
  14.                 'role' => $role
  15.                
  16.  
  17.             );
  18.            
  19.             $QueryResult = $this->db->get_where('admin', $attribute); // select query for code igniter
  20.            
  21.  
  22.            
  23.            
  24.             if($QueryResult -> num_rows() == 1){
  25.  
  26.                
  27.  
  28.                 $attribute_session = array(
  29.  
  30.                     'current_admin_id'  => $QueryResult->row(0)->admin_id,
  31.                     'current_admin_name'  => $username,
  32.                     'session_role' => $role
  33.                
  34.                 );
  35.                
  36.            
  37.  
  38.                 $this->session->set_userdata($attribute_session); // session set afte login succeess
  39.                 return TRUE;
  40.  
  41.             }
  42.             else
  43.             {
  44.                 return FALSE;
  45.                
  46.             }
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement