|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Login Class
|
|
|
|
*/
|
|
|
|
class Login extends CI_Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
// Load model
|
|
|
|
$this->load->model('Regio_model');
|
|
|
|
$regios = $this->Regio_model->get_regio_list();
|
|
|
|
|
|
|
|
// Arrange data
|
|
|
|
foreach ($regios as $regio) {
|
|
|
|
$data['regio'][$regio['id']] = $regio['naam'];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Header
|
|
|
|
$this->load->view('header');
|
|
|
|
|
|
|
|
$this->form_validation->set_rules('username', 'Username', 'required');
|
|
|
|
$this->form_validation->set_rules('password', 'Password', 'required');
|
|
|
|
|
|
|
|
if ($this->form_validation->run() == FALSE)
|
|
|
|
{
|
|
|
|
// login page
|
|
|
|
$this->load->view('login', $data);
|
|
|
|
} else {
|
|
|
|
// check login
|
|
|
|
$this->_checklogin();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Footer
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
private function _checklogin()
|
|
|
|
{
|
|
|
|
// Load model
|
|
|
|
$this->load->model('Login_model');
|
|
|
|
$logincheck = $this->Login_model->check_user();
|
|
|
|
|
|
|
|
if ($logincheck == FALSE) {
|
|
|
|
echo "No user ";
|
|
|
|
} else {
|
|
|
|
echo "Ok";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|