|
|
@ -10,17 +10,16 @@ class Login extends CI_Controller |
|
|
|
public function __construct() |
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
{ |
|
|
|
parent::__construct(); |
|
|
|
parent::__construct(); |
|
|
|
|
|
|
|
$this->load->library('session'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function index() |
|
|
|
public function index() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// redirect if session exists |
|
|
|
// redirect if session exists |
|
|
|
$this->load->library('session'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($this->session->userdata('validated')){ |
|
|
|
if($this->session->userdata('validated')){ |
|
|
|
redirect(base_url('/dashboard')); |
|
|
|
redirect(base_url('/dashboard')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->form_validation->set_rules('username', 'Username', 'required'); |
|
|
|
$this->form_validation->set_rules('username', 'Username', 'required'); |
|
|
|
$this->form_validation->set_rules('password', 'Password', 'required'); |
|
|
|
$this->form_validation->set_rules('password', 'Password', 'required'); |
|
|
|
|
|
|
|
|
|
|
@ -81,7 +80,6 @@ class Login extends CI_Controller |
|
|
|
private function _startsession($userdata) |
|
|
|
private function _startsession($userdata) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Start session with user data |
|
|
|
// Start session with user data |
|
|
|
$this->load->library('session'); |
|
|
|
|
|
|
|
$this->session->set_userdata($userdata); |
|
|
|
$this->session->set_userdata($userdata); |
|
|
|
|
|
|
|
|
|
|
|
// Redirect to dashboard |
|
|
|
// Redirect to dashboard |
|
|
|