SHARE
TWEET

Untitled

a guest Mar 20th, 2017 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class C_login extends CI_Controller {
  4.  
  5.     function __construct() {
  6.         parent::__construct();
  7.         $this->load->model('m_login');
  8.     }
  9.  
  10.     function index() {
  11.         $this->load->view('v_login');
  12.     }
  13.  
  14.     function aksi_login() {
  15.         $user = $this->input->post('user');
  16.         $pass = $this->input->post('pass');
  17.  
  18.         $where = array(
  19.             'user' => $user,
  20.             'pass' => md5($pass)
  21.         );
  22.  
  23.         $cek = $this->m_login->cek_login("t_user", $where)->num_rows();
  24.         if ($cek > 0) {
  25.             $data_session = array(
  26.                 'nama' => $user,
  27.                 'status' => "login"
  28.             );
  29.             $this->session->set_userdata($data_session);
  30.             redirect(base_url("c_home"));
  31.         } else {
  32.             $data["error"] = "Username dan Password Salah";
  33.             $this->load->view('v_login', $data);
  34.             //redirect(base_url("c_login"));
  35.         }
  36.     }
  37.  
  38.     function logout() {
  39.         $this->session->sess_destroy();
  40.         redirect(base_url("c_login"));
  41.     }
  42.  
  43. }
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