<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
/**
	 * 
	 */
	class Login_model extends CI_Model
	{
		
		function __construct()
		{
			parent::__construct();
		}

		public function login()
		{
			$email = $this->input->post('email');
			$pass = $this->input->post('password');

			$this->db->where('email', $email);
			$this->db->where('password', $pass);
			$q = $this->db->get('users');
			if($q->num_rows() > 0){
				$row = $q->row();
				$data = array(
					'id'=> $row->id,
					'name'=> $row->name,
					'email'=> $row->email,
					'type'=> $row->type,
					'date'=> $row->date,
					'status'=> $row->status
				);
				$_SESSION['admin'] = $data;
				return TRUE;
				// echo $q->num_rows();
			}
			return FALSE;
				// echo $q->num_rows();


		}
	}	

?>