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

class Login extends CI_Controller {
	public function __construct(){
		parent::__construct();
		
	 }

	public function index()
	{					
		$this->load->view('login/login');
	}
	public function logout()
	{					
		$this->session->sess_destroy();
		header("location: ".base_url('login'));
	}
	public function cek()
	{
		$username=$this->input->post('username',true);
		$password=md5($this->input->post('password',true));
		$cek = $this->db->query("select * from user where username='$username' and password='$password'")->row_array();
		if($cek){
			$ses = array(
				'username'	=> $username,
				'passwd'	=> $password,
				'nama'		=> $cek['nama']
			);
			$this->session->set_userdata($ses);
			header("location: ".base_url('admin'));
		}

	}
		

}
