<?php
class User_model extends CI_Model {
	
	public function __construct()
	{
		$this->load->database();	
		// mysql_set_charset('utf8');
	}

	public function find_user($log, $pwd)
	{
		$query = $this->db->get_where('users', array('email' => $log, 'pass' => md5($pwd)));
		if ($query->num_rows() == 0) {
			return false;
		} else {
			return $query->row();		
		}
	}

	public function get_user($log)
	{
		$query = $this->db->get_where('users', array('login' => $log));
		if ($query->num_rows() == 0) {
			return false;
		} else {
			return $query->row();		
		}
	}

	public function save_password($pwd)
	{
		$update['pass'] = md5($pwd);
		$this->db->update('users', $update);
	}

}
?>