<?php
class M_login extends CI_Model{
		//SELECT `iduser`, `nama`, `username`, `katasandi`, `status` FROM `user` WHERE 1
		function ceklogin($username, $katasandi){
		$query = $this->db->query("SELECT * FROM user WHERE username = '$username' AND katasandi =md5('$katasandi') AND status='1'   ");	
		$row = $query->row();
		$cek = $query->num_rows();
		if($cek >0){
			return 1;
		}else{
			return 0;
		}
		}	

				
		function cekloginstatus($username, $katasandi){
		$query = $this->db->query("SELECT * FROM user WHERE username = '$username' AND katasandi =md5('$katasandi') AND status='1'   ");	
		$row = $query->row();
		return $row ;

		}

	
		function in($data_save,$table){
					$this->db->insert($table,$data_save);
		} 	
		function update($where,$data,$table){
				$this->db->where($where);
				$this->db->update($table,$data);
		}	
			function hapus($where,$table){
				$this->db->where($where);
				$this->db->delete($table);
		}			
		
}