
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
	class Mod_user extends CI_Model{
		
		function __construct() 
		{
			parent::__construct();
			date_default_timezone_set('Asia/Phnom_Penh');
		}
		
		function getuser($session_id)
		{
			
			$this->db->SELECT('*');
			$this->db->from("ci_sessions");
			//$this->db->where("ip_address",$ip);
			$this->db->where("sessionId",$session_id);
			return $this->db->get();	
			
		}
		
		
		function insertuser($data)
		{
			$this->db->insert('ci_sessions',$data);
		}
		
		
		function updateuser($data)
		{
			$this->db->where("sessionId",$data['sessionId']);
			$this->db->where("ip_address",$data['ip_address']);
			$this->db->update('ci_sessions',$data);	
		}
		
		function deleteuser($time_check)
		{
			$this->db->where("time <",$time_check);
			$this->db->delete('ci_sessions');
		}
		
	}