#!/usr/bin/perl ##################################################### # Script by M.P.Prakash R.Lewis@bestnetcraft.com # # http://www.bestnetcraft.com # # Inclusion of this copyright message is mandatory # # for using this script. # # # # # This script is offered in the same terms as Perl. # # 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. # ##################################################### # Reads the Guide log and displays the content # # Configuration my $diro= 'user/'; # User directory my $log= $diro.'guide.log'; my $pasf='password'; # change this password in the production server # parse the form read(STDIN,$temp,$ENV{'CONTENT_LENGTH'}); @pairs=split(/&/,$temp); foreach $item(@pairs) { ($key,$content)=split(/=/,$item,2); $content=~tr/+/ /; $content=~s/%(..)/pack("c",hex($1))/ge; $content =~ s///g; $fields{$key}=$content; $i++; $item{$i}=$key; $response{$i}=$content; } # Display the start page asking for authentication &start unless ($fields{'auth'}); &nyet('Illegal User') unless ($fields{'auth'} eq $ENV{'SERVER_ADDR'}); &authenticate; sub authenticate { my $pass=$fields{'user_p'}; my $name=$fields{'nama'};# A little more security through obscurity &nyet('Identification Required!') unless ($name); &nyet('Authentication Required!') unless ($pass); if ($pass eq $pasf) { &reportage; } else {&nyet('Wrong User!');} } sub start { print "Content-type: text/html\n\n"; print < Bestnetcraft - User Tracking Report

Bestnetcraft


User Tracking Report

Name:

Password:


©2000-2002. All rights reserved ! eof exit(0); } sub nyet { print "Content-type: text/html\n\n"; print < Error in Information Apparently you have not entered the information in full. $_[0]
Please ensure that you type your name and password correctly. Remember that all the inputs are case-sensitive. Your User details are logged for future reference. In case of persistent problem, please contact us here.

Back endo die "Something is wrong with the $_[0] field.\n"; } sub reportage { # Has many methods of display # 1. Simple table of all entries # 2. Display various targets # 3. Form page to change user name and password my $count=0; open (FILE,"$log") || die "Log file not found \n"; @logs=; close(FILE); # print the report print "Content-type: text/html\n\n"; print qq~ User Tracking Report ~; foreach $no (@logs) { $count++; @fields = split (/\|/,$no); print qq~ ~; foreach $f (@fields) { print ""; } print ""; } print <
Free CGI/Perl scripts,ebooks and customized Web services at down-to-earth prices.
©2000-2002. Bestnetcraft.com All rights reserved !
endo exit(0); }
S.No Date Cat IP Add Referrer
$count $f