<?php

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

class Login_model extends CI_Model{

    function verifyLogin($data){

        $email = $data['email'];
        $password = $data['password'];

        $query = $this->db->get_where('users', array('email' => $email, 'password' => $password));
        $res   = $query->num_rows(); 

        if($res > 0){

            $query = $this->db->get_where('users', array('email' => $email, 'password' => $password));
			$ret = $query->row();

            $login_credentials[] = array(
                'email' => $email,
                'password' => $password,
                'name' => $ret->name,
                'type' => $ret->type
            );
            $_SESSION['login'] = $login_credentials;

            return TRUE;
        }
        else{
            return FALSE;
        }

    }
}

?>