"; print ""; print ""; } if(isset($_GET['saveto']) && isset($_GET['from']) && isset($_GET['to'])){ $from = $_GET['from']; $to = $_GET['to']; $filename = "SignID&Verdict.txt"; /*$sql = "select x.\"SigId\",\"Verdict_Absent\",\"Verdict_Absent Uniq\",\"Safe\",\"Uniq Safe\",\"Malware\",\"Uniq Malware\",\"Unknown\", \"Uniq Unknown\",\"Guid Uniq\",\"Ips Uniq\",(\"FirstSeen\") as first_seen,(\"LastSeen\") as last_seen, (\"UserName\") as \"Sign Creator Analyst Name\",\"Malwarename\", (\"Verdict_Absent\" + \"Safe\" + \"Malware\") as \"Total Caught\", (\"Verdict_Absent Uniq\" + \"Uniq Safe\" + \"Uniq Malware\") as \"Total Caught Uniq\",\"SigFormatName\" from mis.fls_sigid_verdict as x left join mis.fls_sigid_log on (mis.fls_sigid_log.\"SigId\"=x.\"SigId\") left join users on users.\"UserId\" = \"CreateId\" left join sig_formats on (mis.fls_sigid_log.\"SigFormatId\" = sig_formats.\"SigFormatId\") where \"minAddedTs\">='$from' and \"maxAddedTs\" <= '$to' order by \"Total Caught\" desc";*/ // where \"minAddedTs\">='$from' and \"maxAddedTs\" <= '$to' limit 30"; $sql = "SELECT * FROM mis.get_report_fls_sigid_verdict('$from','$to') AS( \"SigId\" integer, \"SigFormatName\" character varying(50) , \"Malwarename\" character varying(250) ,\"Sign Creator Analyst Name\" character varying (50), \"Verdict_Absent\" bigint , \"Verdict_Absent Uniq\" bigint ,\"Safe\" bigint , \"Uniq Safe\" bigint , \"Malware\" bigint , \"Uniq Malware\" bigint , \"Unknown\" bigint , \"Uniq Unknown\" bigint ,\"Guid Uniq\" bigint , \"Ips Uniq\" bigint ,\"FirstSeen\" timestamp without time zone ,\"LastSeen\" timestamp without time zone , \"Total Caught\" bigint ,\"Total Caught Uniq\" bigint)"; $res = odbc_exec($db_conn,$sql); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.$filename); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); ob_clean(); flush(); print "SignID;SignType;Malwarename;Sign Creator Analyst Name;SHA1_Verdict_Absent Total;SHA1_Verdict_Absent Unique;SHA1_Verdict_Safe Total;SHA1_Verdict_Safe Unique;SHA1_Verdict_Malware Total;SHA1_Verdict_Malware Unique;SHA1_Verdict_Unknown Total;SHA1_Verdict_Unknown Unique;TotalCaught;TotalCaught Unique;GUIDs Unique;Ips Unique;FirstSeen;LastSeen\n"; while(odbc_fetch_row($res)){ // $TotalCaught = odbc_result($res,"Verdict_Absent") + odbc_result($res,"Safe") + odbc_result($res,"Malware") + odbc_result($res,"Unknown"); // $TotalCaughtU = odbc_result($res,"Verdict_Absent Uniq") + odbc_result($res,"Uniq Safe") + odbc_result($res,"Uniq Malware") + odbc_result($res,"Uniq Unknown"); print odbc_result($res,"SigId").";".odbc_result($res,"SigFormatName").";".odbc_result($res,"Malwarename").";"; print odbc_result($res,"Sign Creator Analyst Name").";"; print odbc_result($res,"Verdict_Absent").";".odbc_result($res,"Verdict_Absent Uniq").";"; print odbc_result($res,"Safe").";".odbc_result($res,"Uniq Safe").";".odbc_result($res,"Malware").";" .odbc_result($res,"Uniq Malware").";"; print odbc_result($res,"Unknown").";".odbc_result($res,"Uniq Unknown").";".odbc_result($res,"Total Caught").";".odbc_result($res,"Total Caught Uniq").";"; print odbc_result($res,"Guid Uniq").";".odbc_result($res,"Ips Uniq").";". odbc_result($res,"FirstSeen").";".odbc_result($res,"LastSeen")."\n"; } } ?>