| Right click this window and select "view source" in order to copy the source for this script.
#!/usr/local/bin/perl
###########################
#IP Logger
$t = localtime;
$ip = "$ENV{'REMOTE_ADDR'}";
###########################
open(IN, "logger.gif");
binmode(IN);
read(IN, $image, -s "logger.gif");
close(IN);
###########################
binmode(STDOUT);
print "Content-type: image/gif\n";
print "\n";
print $image;
###########################
open(OUT, ">>log.htm"); #Opens log.htm for Output of IP Address
print OUT "Access from: $ip at $t\n"; #Outputs the Ip address to log.htm.
close(OUT);
|
User IP GIF Logger
This routine will save the IP of the user as well as his localtime when a page is accessed. The code is shown but this is NOT live. Be certain to use a proper PERL or CGI name extension on this program. You may directly highlight, copy and paste the above full program.
|