SHARE
TWEET

Untitled

a guest Apr 2nd, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Welcome extends CI_Controller {
  5.  
  6.     function logout(){
  7.     $this->session->unset_userdata('isLogin');
  8.     redirect("admin/index");
  9. }
  10.     public function index()
  11.     {
  12.         $this->load->view('welcome_message');
  13.     }
  14.     public function ceklogin(){
  15.         if (isset($_POST['login'])) {
  16.             $user = $this->input->post('user',true);
  17.             $pass = $this->input->post('pass',true);
  18.             $cek = $this->app_model->proseslogin($user,$pass);
  19.             $hasil = count($cek);
  20.             if($hasil > 0) {
  21.                 $pelogin = $this->db->get_where('tbuser',array('username' => $user , 'password' => $pass))->row();
  22.                 if($pelogin->level == 'admin'){
  23.                     redirect('welcome/admin');
  24.                 }elseif($pelogin->level == 'guru'){
  25.                     redirect('welcome/guru');
  26.                 }elseif($pelogin->level == 'siswa'){
  27.                     redirect('welcome/beranda');
  28.                 }
  29.             }else {
  30.                 redirect('welcome/index');
  31.             }
  32.         }
  33.         }
  34.         public function beranda(){
  35.             $this->load->view('beranda');
  36.     }
  37.     public function admin(){
  38.         $this->load->view('admin');
  39. }
  40. public function guru(){
  41.     $this->load->view('guru');
  42.  
  43. }
  44. }
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