#!/usr/bin/perl ##################################################### # Script by MP.Prakash R.Lewis # # http://www.bestnetcraft.com # # This script is offered in the same terms as Perl. # # Inclusion of this copyright message is mandatory # # for using this script. # # Comments and suggestions may be sent through # # http://www.bestnetcraft.com/contact.html # # No liability or damage will be accepted by the # # author under any circumstances. # ##################################################### # configuration - Modify as per your requirement my $file="/new.log"; my $pw="password"; # End of user defined variables # Do NOT change anything below my $envy=$ENV{'QUERY_STRING'}; ($sec,$min,$hour,$mday,$mon,$year,$wday)=(localtime(time))[0,1,2,3,4,5,6]; $time= sprintf("%02d:%02d:%02d",$hour,$min,$sec); $year +=1900; $mon +=1; $dayo ="$mday/$mon/$year:-$hour:$min"; if ($envy eq $pw) {&reportage;} open( LOG, ">>$file" ); print LOG "$dayo\|$ENV{ 'REMOTE_ADDR' }\|$ENV{'HTTP_USER_AGENT'}\|$envy\n"; close LOG; exit(0); sub reportage { open(FILE,"$file"); @logs = ; close(FILE); $log_num = $#logs+1; print "Content-type: text/html\n\n"; print qq~ Server Access Log

Your server at $ENV{'SERVER_ADDR'} is loading $log_num records.

~; $count = 0; foreach $l (@logs) { $count++; @fields = split (/\|/,$l); print qq~ ~; foreach $f (@fields) { print ""; } print ""; } print qq~
S.NoDateIP AddUserAgentBrowser
$count $f
~; exit(0); }