} die("depreciated"); if(!file_exists($file)){write_syslog(" Unable to stat $file",__FILE__);} $q=new mysql(); $q->BuildTables(); if(!$q->TestingConnection()){write_syslog("Unable to logon to mysql",__FILE__);} $datas_file=file_get_contents($file); $datas=explode("\n",$datas_file); write_syslog("$file: ".Count($datas) . " line(s) with " . strlen($datas_file). " bytes length",__FILE__); while (list ($num, $val) = each ($datas) ){ if(trim($val==null)){continue;} if($_GET["DEBUG"]){echo "Parsing line number $num/".Count($datas)."\n";} parseDansLine($val); } @unlink($file); System("/etc/init.d/artica-postfix restart squid &"); function parseDansLine($line){ if(!preg_match('#([0-9\.]+)\s+([0-9\:]+)\s+-\s+(.+?)\s+ht#',$line,$re)){ echo "Failed parsed \"$line\"\n"; } $line="ht".str_replace($re[0],'',$line); $date=str_replace('.',"-",$re[1]) . " " . $re[2]; $client=$re[3];
} $q = new mysql_squid_builder(); if (!$q->TestingConnection()) { write_syslog("Unable to logon to mysql", __FILE__); } $datas_file = file_get_contents($file); $datas = explode("\n", $datas_file); write_syslog("{$file}: " . Count($datas) . " line(s) with " . strlen($datas_file) . " bytes length", __FILE__); while (list($num, $val) = each($datas)) { if (trim($val == null)) { continue; } if ($_GET["DEBUG"]) { echo "Parsing line number {$num}/" . Count($datas) . "\n"; } if (!parseDansLine($val)) { return; } } @unlink($file); System("/etc/init.d/artica-postfix restart squid &"); function parseDansLine($line) { if (!preg_match('#([0-9\\.]+)\\s+([0-9\\:]+)\\s+-\\s+(.+?)\\s+ht#', $line, $re)) { echo "Failed parsed \"{$line}\"\n"; } $line = "ht" . str_replace($re[0], '', $line); $date = str_replace('.', "-", $re[1]) . " " . $re[2]; $client = $re[3]; if (!preg_match('#^(.+?)\\s+#', $line, $re)) { echo "Failed {$line} " . __LINE__ . "\n";