1) $sql_post .= " AND id_grupo = $ev_group"; if ($status == 1) $sql_post .= " AND estado = 1"; if ($status == 0) $sql_post .= " AND estado = 0"; if ($search != "") $sql_post .= " AND evento LIKE '%$search%'"; if (($event_type != "all") AND ($event_type != 0)) $sql_post .= " AND event_type = '$event_type'"; if ($severity != -1) $sql_post .= " AND criticity >= $severity"; if ($id_agent != -1) $sql_post .= " AND id_agente = $id_agent"; $sql2 = "SELECT * FROM tevento WHERE 1=1 "; $sql2 .= $sql_post . " ORDER BY timestamp DESC"; $now = date("Y-m-d"); // Show contentype header Header("Content-type: text/txt"); header('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.txt"'); echo "timestamp, agent, group, event, status, user, event_type, severity"; echo chr(13); $result=mysql_query($sql2); while ($row=mysql_fetch_array($result)){ $id_grupo = $row["id_grupo"]; if (give_acl($config["id_user"], $id_grupo, "AR") == 1){ // Only incident read access to view data ! echo $row["timestamp"]; echo ", "; echo get_db_sql("SELECT nombre FROM tagente WHERE id_agente = '".$row["id_agente"]."'"); echo ", "; echo get_db_sql("SELECT nombre FROM tgrupo WHERE id_grupo = '".$row["id_grupo"]."'"); echo ", "; echo $row["evento"]; echo ", "; echo $row["estado"]; echo ", "; echo $row["id_usuario"]; echo ", "; echo $row["event_type"]; echo ", "; echo $row["criticity"]; echo chr(13); } } ?>