<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Login extends CI_Controller {

	//load model
	public function __construct()
	{
		parent::__construct();
		$this->load->model('dashboard_model');		
	}
	
	public function index()
	{
		//validasi input
		$userid  = $this->input->post('userid');
		$password  = $this->input->post('password');
		//check input
		$this->form_validation->set_rules('userid', 'Userid', 'required',
			array(	'required'	=> '%s harus diisi'));

		$this->form_validation->set_rules('password', 'Password', 'required',
			array(	'required'	=> '%s harus diisi'));

		if($this->form_validation->run())
		{
			//proses ke simple login
			$this->simple_login->login($userid,$password);
		}

		//end validasi
		$data =array ('title'=> 'Aplikasi PPDB MTD - Login');
		$this->load->view('login/list', $data, FALSE);
	}

	//fungsi logout
	public function logout()
	{
		//ambil fungsi logout dari simple login
		$this->simple_login->logout();
	}

}

/* End of file Login.php */
/* Location: ./application/controllers/Login.php */