SHARE
TWEET

controller

a guest Dec 23rd, 2017 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     function login(){
  2.         $this->load->view('form_login');
  3.     }
  4.    
  5.     function proses_login() {
  6.         if($this->input->is_ajax_request())
  7.         {
  8.             $username = $this->input->post('username');
  9.             $password = $this->input->post('password');        
  10.  
  11.             $hasil = $this->model_operator->login($username);
  12.  
  13.             if($hasil['result']){
  14.                 if(password_verify($password,$hasil['password'] === TRUE)){                    
  15.  
  16.                         $data_session = array(
  17.                             'id_operator'   => $hasil['operator_id'],
  18.                             'nama_operator' => $hasil['nama_lengkap'],
  19.                             'username'      => $hasil['username']
  20.                         );
  21.                         $this->session->set_userdata('user_auth',$data_session);
  22.  
  23.                         echo json_encode(array('result'=>true,'cek_username' => true));
  24.                        
  25.                     }else{
  26.                         echo json_encode(array('result'=>false,'cek_username' => true));
  27.                        
  28.                     }
  29.             }          
  30.         }else{
  31.             redirect(base_url(),'refresh');
  32.         }
  33.  
  34.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top