Advertisement
Guest User

Login.php

a guest
Mar 29th, 2020
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. class Login extends CI_Controller
  4. {
  5.    public function __construct()
  6.    {
  7.        parent::__construct();
  8.        $this->load->model("user_model");
  9.         $this->load->library('form_validation');
  10.         // $this->output->enable_profiler(TRUE);
  11.     }
  12.  
  13.     public function index()
  14.     {
  15.         if ($this->input->post()) {
  16.             if ($this->user_model->doLogin()) {
  17.                 if ($this->session->user_logged->role==1) redirect(site_url('admin'));
  18.                 else if ($this->session->user_logged->role==2) redirect(site_url('kasir'));
  19.             }
  20.         }
  21.         $this->load->view("admin/login_page.php");
  22.     }
  23.  
  24.     public function logout()
  25.     {
  26.         $this->session->sess_destroy();
  27.         redirect(site_url('admin/login'));
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement