Initial commit
This commit is contained in:
commit
529efd53a1
140 changed files with 10310 additions and 0 deletions
130
sendmail-log.php
Normal file
130
sendmail-log.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
include_once("./include/cfg-petar.php");
|
||||
include_once("./include/layout.php");
|
||||
include_once("./include/users.php");
|
||||
include_once("./include/cfg-sendmail.php");
|
||||
|
||||
?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
<?php require 'include/inc-header.php';?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
<?php require 'include/inc-top.php';?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
<tr bgcolor=navy align=center>
|
||||
<td colspan=2><font color=yellow><b>sendmail log</b></font></td>
|
||||
|
||||
<tr>
|
||||
<td align=left bgcolor=#dddddd colspan=2>
|
||||
|
||||
<FORM NAME=search ACTION=<?php echo $_SERVER["PHP_SELF"]; ?> METHOD=POST>
|
||||
Comandi disponibili:
|
||||
[ <a href=<?php echo $_SERVER["PHP_SELF"]; ?>>Reset</a> ]
|
||||
[ <a href='javascript:document.search.submit();'>Ricerca</a> ]
|
||||
<p>
|
||||
<?php
|
||||
|
||||
echo "<p>".
|
||||
"Chiave di ricerca: ".
|
||||
"<select name=search_key_auto>".
|
||||
"<option value=''>-</option>".
|
||||
"<option value='Greylisting in action'>Greylist</option>".
|
||||
"<option value='X-Spam-Status: No'>No Spam</option>".
|
||||
"<option value='X-Spam-Status: Yes'>Spam</option>".
|
||||
"<option value='MAILER-DAEMON'>Errore di consegna</option>".
|
||||
"<option value='User unknown'>Utente sconosciuto</option>".
|
||||
"<option value='Too many recipients'>Troppi destinatari</option>".
|
||||
"<option value='TLD'>TLD indesiderato</option>".
|
||||
"<option value='Mass Marketing'>Mass marketing</option>".
|
||||
"</select> oppure : <INPUT TYPE=TEXT NAME=search_key SIZE=50 MAXLENGTH=50 VALUE=".($_REQUEST["search_key"] ?? '').">";
|
||||
|
||||
echo " ".
|
||||
"Giorno: ".
|
||||
"<select name=sendmail_log>";
|
||||
|
||||
chdir($sendmail_log_dir);
|
||||
echo "<option value='maillog'>Today</option>";
|
||||
array_multisort(array_map('filemtime', ($logfiles = glob("maillog.*", GLOB_BRACE))), SORT_DESC, $logfiles);
|
||||
foreach($logfiles as $file)
|
||||
{
|
||||
echo "<option value=".$file.">".date ("M d Y D", filemtime($sendmail_log_dir."/".$file)-3600)."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
|
||||
echo " ".
|
||||
"Nr risultati: ".
|
||||
"<select name=search_max_results>".
|
||||
"<option value='999999'>Tutti</option>".
|
||||
"<option value='5'>5</option>".
|
||||
"<option value='10'>10</option>".
|
||||
"<option value='25'>25</option>".
|
||||
"<option value='75'>50</option>".
|
||||
"<option value='250'>250</option>".
|
||||
"<option value='750'>750</option>".
|
||||
"</select></FORM>";
|
||||
|
||||
|
||||
if (($_REQUEST["search_key"] ?? '') || ($_REQUEST["search_key_auto"] ?? '')){
|
||||
|
||||
if ( $_REQUEST["search_key_auto"] ) { $_REQUEST["search_key"] = $_REQUEST["search_key_auto"]; }
|
||||
|
||||
# $result=exec($grepbin." '".$_REQUEST["search_key"]."' ".$sendmail_log_dir."/".$_REQUEST["sendmail_log"]."| cut -f4 -d: | sort -u", $codici);
|
||||
|
||||
$result=exec("/usr/local/bin/sudo ".$mng_maillog." STEP1 '".$_REQUEST["search_key"]."' ".$sendmail_log_dir."/".$_REQUEST["sendmail_log"], $codici);
|
||||
# var_dump($codici);
|
||||
|
||||
echo "Chiave di ricerca selezionata: '<font color=red>".$_REQUEST["search_key"]."</font>'".
|
||||
" - ".
|
||||
"Numero massimo risultati: '<font color=red>".$_REQUEST["search_max_results"]."</font>'";
|
||||
|
||||
echo " - ".
|
||||
"DEBUG: "."/usr/local/bin/sudo ".$mng_maillog." STEP1 '".$_REQUEST["search_key"]."' ".$sendmail_log_dir."/".$_REQUEST["sendmail_log"];
|
||||
"<p>";
|
||||
|
||||
$counter = 0;
|
||||
foreach($codici as $codice) {
|
||||
|
||||
if ($counter == $_REQUEST["search_max_results"]) {
|
||||
break; /* Equivalente a 'break 1;' */
|
||||
}
|
||||
|
||||
# Il codice e' di 14 ma c'e' uno spazio all'inizio
|
||||
if (strlen($codice) <> 15) { continue; }
|
||||
|
||||
echo "<tr align=left><td align=left colspan=3> </td>";
|
||||
echo "<tr align=left bgcolor=navy><td align=left colspan=1><a href=".$_SERVER["PHP_SELF"].">clear</a></td>".
|
||||
"<td colspan=2><FONT color=yellow>".++$counter." - msg ID :".$codice."</td>";
|
||||
|
||||
$cmdstr="/usr/local/bin/sudo ".$mng_maillog." STEP2 ".$codice." ".$sendmail_log_dir."/".$_REQUEST["sendmail_log"];
|
||||
$fp = popen($cmdstr, 'r');
|
||||
while ($line = fgets($fp, 4096)){
|
||||
preg_match_all("|(.{15}).*:(.*):(.*)$|U",$line,$out, PREG_PATTERN_ORDER);
|
||||
echo "<tr align=left>";
|
||||
$out[3][0] = str_replace(">",">", $out[3][0]);
|
||||
$out[3][0] = str_replace("<","<", $out[3][0]);
|
||||
$out[3][0] = str_replace($_REQUEST["search_key"], "<font color=red>".$_REQUEST["search_key"]."</font>", $out[3][0]);
|
||||
echo "<td style='width:10%'>".$out[1][0]."</font>";
|
||||
# echo "<td colspan=2><font color=$fnt_color>".htmlentities($out[3][0])."</font>";
|
||||
echo "<td colspan=2>".$out[3][0]."</font>";
|
||||
}
|
||||
pclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
|
||||
<?php require 'include/inc-footer.php';?>
|
||||
|
||||
<!-- ------------------------------------------------------------------------ -->
|
||||
Loading…
Add table
Add a link
Reference in a new issue