<?php

if(!defined('BASEPATH')) exit('Hacking Attempt : Get Out of the system ..!');

class Login_model extends CI_Model

{

public function __construct()

{

parent::__construct();

}

public function takeUser($username, $password, $status)

{

$this->db->select('*');

$this->db->from('admin_login');
$this->db->where('username', $username);
$this->db->where('password', $password);
$this->db->where('status', $status);
$query = $this->db->get();
return $query->num_rows();

}

public function userData($username)

{

$this->db->select('*');
$this->db->where('username', $username);
$query = $this->db->get('admin_login');
$result = $query->row();
$this->userlogindt($result->id);
return $result;

}

public function userlogindt($id)
{
	$this->db->where('id', $id);
	$this->db->update('admin_login', array('lastlogin'=>date('Y-m-d H:i:s')));

}

}
