BenitoDannes

Login.php

Mar 11th, 2020
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 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.     }
  11.  
  12.     public function index()
  13.     {
  14.         // jika form login disubmit
  15.         if($this->input->post()){
  16.             if($this->user_model->doLogin()) redirect(site_url('admin'));
  17.         }
  18.  
  19.         // tampilkan halaman login
  20.         $this->load->view("admin/login_page.php");
  21.     }
  22.  
  23.     public function logout()
  24.     {
  25.         // hancurkan semua sesi
  26.         $this->session->sess_destroy();
  27.         redirect(site_url('admin/login'));
  28.     }
  29. }
Add Comment
Please, Sign In to add comment