db->query("select userid as total from akun_unlasys 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_unlasys where passwd = '$passwd' and userid = '$userid'"); $row = $query->num_rows(); if ($row < 1){ return FALSE; }else{ return TRUE; } } function valid_password_64($userid, $pass_64) { $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("select password from pengguna where password = '$pass_64' 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_unlasys AS a JOIN otoritas AS o ON o.id_otoritas = a.id_otoritas WHERE a.userid = '$username' "); return $query; } /*function user_data_2($username){ $KEDUA = $this->load->database('second', TRUE); $query = $KEDUA->query("SELECT userid, nmlengkap, idklppengguna FROM pengguna WHERE userid = '$username' "); return $query; }*/ function last_login($no, $data){ $where = "userid = '$no'"; $this->db->where($where); if ($this->db->update("akun_unlasys", $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_unlasys 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_unlasys', $data); } }