Lecteur de log HB


'; while ($fichier = readdir($pointeur)) { if ($fichier == '.' || $fichier == '..') { continue; } print ''.$fichier.'
'; } } else { if (!empty($_GET['file']) && str_replace("..", '', $_GET['file']) != $_GET['file']) { die('Accès au fichier non autorisé !'); } $file = dir.$_GET['file']; print '

Fichier : '.$file.'


'; if (!is_file($file)) { die('Fichier introuvable !'); } $fichier = @fopen($file, 'r+'); $contenu_log = fread($fichier, filesize($file)); fclose($fichier); $exp = "#\[(\d{2}/\d{2}/\d{2} \d{2}:\d{2}:\d{2})\] (\\w{6,13}) : ([^\[]{0,1000}) \[(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\] \[(\w{3,4})\] \[/([^\[]{1,200})\] \[([^\[]{0,200})\] \[([^\[]{0,75})\]#ui"; preg_match_all($exp, htmlentities(trim(str_replace("\n", ' ', $contenu_log))), $m); if (empty($m[0][0])) { print '
'.$contenu_log.'
'; } else { print ''; foreach ($m[0] as $key => $lign) { if (preg_match('#array#', $m[3][$key])) { $exp = "#array \(( '(.{1,10})' => '([^',]{0,1000})',)( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?( '(.{1,10})' => '([^',]{0,1000})',)?#ui"; preg_match_all($exp, $m[3][$key], $mArray); $m[3][$key] = ''; foreach ($mArray as $k => $lign) { if ($k == 0 || $k%3 == 1) { continue; } if ($lign[0] == "") { break; } if ($k%3 == 2) { $m[3][$key] .= ''.$lign[0].' : '; } else { $m[3][$key] .= (strlen($lign[0])>80?''.substr($lign[0], 0, 77).'...':$lign[0]).'
'; } } } if ($m[2][$key] == "ERREUR") { print ''; } elseif ($m[2][$key] == "AVERTISSEMENT") { print ''; } else { print ''; } print ' '; } print '
Date Type Message IP + ...
'.$m[1][$key].'
'.$m[5][$key].'
'.$m[2][$key].'
'.(strlen($m[6][$key])>30?''.substr($m[6][$key], 0, 27).'...':$m[6][$key]).'
'.$m[3][$key].' '.$m[4][$key].'
'.$m[8][$key].'
'; } } ?>