SHARE
TWEET

Untitled

babebabebabebabe Apr 2nd, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class Login extends CI_Controller{
  4.     function __construct(){
  5.         parent::__construct();
  6.         $this->load->model('m_login');
  7.     }
  8.  
  9.  
  10.     function index(){
  11.         $this->load->view('login');
  12.     }
  13.  
  14.     function auth(){
  15.         $user = $this->input->post('user');
  16.         $pass = $this->input->post('pass');
  17.  
  18.         $cek_admin = $this->m_login->cek_admin($user,$pass);
  19.  
  20.         if($cek_admin->num_rows()>0){
  21.             $data=$cek_admin->row_array();
  22.             $this->session->set_userdata('masuk',TRUE);
  23.             $this->session->set_userdata('nama',$data['admin']);
  24.             $this->session->set_userdata('status','admin');
  25.             redirect('page');
  26.         }else{
  27.             $cek_op = $this->m_login->cek_op($user,$pass);
  28.  
  29.             if($cek_op->num_rows()>0){
  30.                 $data=$cek_op->row_array();
  31.                 $this->session->set_userdata('masuk',TRUE);
  32.                 $this->session->set_userdata('nama',$data['op']);
  33.                 $this->session->set_userdata('status','operator');
  34.                 redirect('page');
  35.             }else{
  36.                 redirect('login');
  37.             }
  38.         }
  39.     }
  40.  
  41.     function keluar(){
  42.         $this->session->sess_destroy();
  43.         redirect('login');
  44.     }
  45. }
  46.  
  47.  ?>
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