Initial commit
This commit is contained in:
commit
529efd53a1
140 changed files with 10310 additions and 0 deletions
109
squid-log.php
Normal file
109
squid-log.php
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
# vers.20120625.01
|
||||
|
||||
include_once("./include/cfg-petar.php");
|
||||
include_once("./include/layout.php");
|
||||
include_once("./include/users.php");
|
||||
include_once("./include/cfg-squid.php");
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
<?php require 'include/inc-header.php';?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
<?php require 'include/inc-top.php';?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
|
||||
<tr bgcolor=navy align=center>
|
||||
<td colspan=3><font color=yellow><b>squid logs</b></font></td>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if ($check_pkg_install == true ) {
|
||||
|
||||
$result = shell_exec("pkg_info | grep squid ");
|
||||
if ( $result == "" ) {
|
||||
$errore .= "- squid non e' installato<br>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($errore) {
|
||||
|
||||
echo "<tr><td colspan=4><font color=red><b>Errori rilevati:<br>".$errore."</b></font></td></tr>".
|
||||
"<tr><td colspan=4>questo check puo' essere evitato settando la variabile <b>check_pkg_install=false</b> ".
|
||||
"in <b>include/cfg-squid.php</b></td></tr>";
|
||||
"</table>";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "<tr align=left><td width=100% colspan=3><FORM NAME=search ACTION=".$_SERVER["PHP_SELF"]." METHOD=POST>".
|
||||
"Chiave di Ricerca: <INPUT TYPE=TEXT NAME=search_key SIZE=20 MAXLENGTH=20 VALUE=".$_REQUEST["search_key"].">";
|
||||
|
||||
echo " ";
|
||||
|
||||
echo "Periodo: ".
|
||||
"<select name=squid_log_file>";
|
||||
|
||||
$logfiles = scandir($squid_log_dir);
|
||||
foreach ($logfiles as $file) {
|
||||
if (substr($file,0,strlen($squid_log_file)) == $squid_log_file) {
|
||||
echo "<option value=".$file.">$file</option>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</select>";
|
||||
|
||||
echo " [ <a href='javascript:document.search.submit();'>Cerca</a> ]".
|
||||
"</FORM>";
|
||||
|
||||
|
||||
|
||||
if ($_REQUEST["search_key"]){
|
||||
|
||||
|
||||
echo "<tr align=left bgcolor=navy><td colspan=3><FONT color=yellow>Analisi del file: ".$_REQUEST["squid_log_file"].
|
||||
" con chiave: ".$_REQUEST["search_key"];
|
||||
|
||||
echo "<tr align=left bgcolor=navy>".
|
||||
"<td width=50><FONT color=yellow>Data".
|
||||
"<td width=50><FONT color=yellow>Indirizzo IP".
|
||||
"<td ><FONT color=yellow>Destinazione";
|
||||
|
||||
|
||||
$cmdstr = $grepbin." ".$_REQUEST["search_key"]." ".$squid_log_dir."/".$_REQUEST["squid_log_file"];
|
||||
echo "DEBUG: $cmdstr\n";
|
||||
|
||||
$fp = popen($cmdstr, 'r');
|
||||
|
||||
while ($line = fgets($fp, 4096)){
|
||||
|
||||
preg_match_all("|(.{14}).{7} (.*) .* .* .* (.*) .*$|U",$line,$out, PREG_PATTERN_ORDER);
|
||||
|
||||
echo "<tr align=left>";
|
||||
echo "<td>".date("d.m.Y - h:i:s",$out[1][0]);
|
||||
echo "<td>".$out[2][0];
|
||||
echo "<td>".htmlentities(substr($out[3][0],0,80))." ...";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
<?php require 'include/inc-footer.php';?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
Loading…
Add table
Add a link
Reference in a new issue