Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. class Login extends Controller
  3. {
  4.     private $_username;
  5.     private $_password;
  6.  
  7.     function __construct()
  8.     {
  9.         parent::Controller();
  10.         $this->_username = $this->input->post('username');
  11.         $this->_password = $this->input->post('password');
  12.     }
  13.     function index()
  14.     {  
  15.         if(!$this->_username || !$this->_password)
  16.         {
  17.             $sessionData = array('loginError' => true, 'type' => 1);
  18.             $this->session->set_flashdata($sessionData);
  19.             redirect('/'); 
  20.         }
  21.         else
  22.         {
  23.             $this->_procLogin();
  24.         }
  25.     }
  26.    
  27.     function _procLogin()
  28.     {
  29.         $this->load->model('loginmodel');
  30.         if($this->loginmodel->checkLogin($this->_username, $this->_password))
  31.         {
  32.             echo 'login success';
  33.         }
  34.         else
  35.         {
  36.             echo 'login failed';
  37.         }
  38.     }
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement