db->query("select userid as total from akun_siak where userid = '$str'"); $row = $query->num_rows(); if ($row < 1){ return FALSE; }else{ return TRUE; } } function valid_password($userid, $passwd){ $query = $this->db->query("select passwd from akun_siak where passwd = '$passwd' and userid = '$userid'"); $row = $query->num_rows(); if ($row < 1){ return FALSE; }else{ return TRUE; } } function user_data($username){ $query = $this->db->query("SELECT *, o.nama_otoritas FROM akun_siak AS a JOIN otoritas AS o ON o.id_otoritas = a.id_otoritas WHERE a.userid = '$username' "); return $query; } function last_login($no, $data){ $where = "userid = '$no'"; $this->db->where($where); if ($this->db->update("akun_siak", $data)){ return $no; } else { return FALSE; } } function cek_akses($otoritas_id, $menu_id){ $query = $this->db->query("select id_otomenu as total from otoritas_menu where id_otoritas = '$otoritas_id' and id_menu = '$menu_id'"); $row = $query->num_rows(); if ($row < 1){ return FALSE; }else{ return TRUE; } } function cek_action($action, $otoritas_id, $menu_id){ $data = $this->db->select($action) ->where('id_otoritas', $otoritas_id) ->where('id_menu', $menu_id) ->get('otoritas_menu') ->result(); foreach ($data as $row){return $row->$action;} } function detail_akun($id_akun){ $query = $this->db->query("SELECT *, o.nama_otoritas FROM akun_siak as a JOIN otoritas as o ON o.id_otoritas = a.id_otoritas WHERE a.id_akun = $id_akun "); return $query; } function update_akun($id, $data){ $this->db->where('id_akun', $id); $this->db->update('akun_siak', $data); } }