". date('Y M d') ."\n\n\n"; $paths=array( "rhaworth.net" => array("", "mikrocosm.com/", "robust-ae.com/", "theplayersofstpeter.org.uk/","posp.org.uk/"), "southlondonquakers.org.uk" => array("","croydonquakers.org.uk/","slaqm.org.uk/", "purleyquakers.org.uk/","epsomquakers.org.uk/"), "shakespearereadingsociety.co.uk" => array("") ); foreach($paths[$_SERVER['HTTP_HOST']] as $p) { one_file("../../logs/{$p}access_log.webstat"); one_file("../../logs/{$p}access_ssl_log.webstat"); } exit; function one_file($fnam) { global $_g; echo substr($fnam,6); if (false===($hnd=fopen($fnam,'rb'))) { echo " not found\n\n\n"; return; } $stat=fstat($hnd); if (function_exists(posix_getpwuid)) {$uid=posix_getpwuid($stat['uid']); $username=$uid['name']; } else { $username=$stat['uid']; } echo " ". date('Y M d h:m:d',$stat['ctime']). " ". number_format($stat['size'],0,"."," ") ." bytes". " ". decoct($stat['mode']). " $username\n\n"; if (!$stat['size']) { echo "\n"; return; } $trnchsiz=1024; fseek($hnd,0); $txt=fread($hnd,$trnchsiz); $j=strpos($txt,"\n"); echo substr($txt,0,$j) ."\n"; fseek($hnd,-$trnchsiz,SEEK_END); $txt=fread($hnd,$trnchsiz-1); $j=strrpos($txt,"\n"); echo substr($txt,$j) ."\n"; $trnchsiz=500000; if (false && isset($_REQUEST['trunc']) && $stat['size']>$trnchsiz) { fseek($hnd,-$trnchsiz,SEEK_END); $txt=fread($hnd,$trnchsiz); $j=strpos($txt,"\n"); fclose($hnd); echo file_put_contents($fnam,substr($txt,$j+1)); echo "Truncated\n"; } fclose($hnd); echo "\n\n"; } ?>