num_rows != 0){ while($oper = $res->fetch_assoc()){ array_push($opers,get_oper_from_id_obj($oper['id'])); } } return $opers; } function get_opers_for_user_obj($id){ $opers = Array(); $res = query("SELECT o.id FROM opers o WHERE o.manager_id = %d OR o.user_id = %d",Array($id,$id)); if($res && $res->num_rows != 0){ while($oper = $res->fetch_assoc()){ array_push($opers,get_oper_from_id_obj($oper['id'])); } } return $opers; } function get_oper_from_id_obj($id){ $opers = Array(); $res = query("SELECT o.id,o.nick,o.password,o.password_type,o.swhois,o.flags,o.user_id,o.manager_id FROM opers_v o WHERE o.id = %d",Array($id)); if($res && $res->num_rows == 1){ $oper = $res->fetch_assoc(); $hosts = query("SELECT h.host FROM hosts h WHERE oper_id = %d",Array($oper['id'])); if($hosts->num_rows != 0){ $oper['hosts'] = Array(); while($host = $hosts->fetch_assoc()){ array_push($oper['hosts'],$host['host']); } }else{ $oper['hosts'] = Array('*@*'); } if(!isset($oper['user_id'])){ $oper['user_id'] = '-'; } return $oper; } return $opers; } function get_opers_html($opers){ global $u; global $user; if(!isset($u)){ $u = $user; } $ret = ""; foreach($opers as $k => $oper){ $ret .= "