<?php

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



class UsersData extends CI_Model {



    function addUser($data){

		$user = $this->db->get_where('sk_users', array('macid' => $data['macid']))->row();
        
		if (!empty($user)){
			
			$this->db->where('macid', $data['macid']);
			$this->db->update('sk_users', $data);
		}else{
			$this->db->insert('sk_users', $data);
		}
        
		$user = $this->db->get_where('sk_users', array('macid' => $data['macid']))->row();
		return $user;
	
    }
	
	 function getUser($data){
        
		$user = $this->db->get_where('sk_users', array('macid' => $data['macid']))->row();
		
		return $user;
	}
	
	function saveUserExpiry($data){

		$user = $this->db->get_where('sk_users', array('macid' => $data['macid']))->row();
			if (!empty($user)){
				$this->db->update('sk_users', $data);
			}else{
				
			}
	}
		
	function getUserExpiry($data){
			
		$user = $this->db->get_where('sk_users', array('macid' => $data['macid']))->row();			
		return $user;
	}

}