Please can you help me, I am trying to write a CGI script that behaves as follows; every time a browser requests an image from a particular page, the script captures the IP address of the browser and appends it to a file. This 'log-file' needs to be in the form of an HTML document.

This might do it for you... it's nothing fancy but it will give you a good base. Some ideas could be also adding the date to it so you know when, maybe also the time. Well I hope this does something for you. Just let me know.

#!/usr/bin/perl5.004

# NOTE: make sure you create a file called # log.html and place it in the appropriate # place on your server. # ALSO: you can access this script # with server side include by entering # <!--#exec cgi="/cgi-bin/counter.cgi"--> # into whatever page you want to log from. # Hope this gives you something to at least start # with, enjoy! # M.M. computersmarts.net

print "Content-type: text/html\n\n";

##################################################### # This is the URL of where you image is located # ##################################################### $imageurl = "http://www.whoknows.com/images/log.gif";

##################################################### # This is the PATH to where it will store the IP's # #####################################################

$logfile = "/home/computersmarts/www"; # NO FORWARD /

##################################################### # And here is the script in action # #####################################################

Cheers ComputerSmarts, that looks like a good start indeed; I've tried to incorporate my own server settings and path details, but I'm afraid my script 'exploded' - can you spot any glaring errors! P.S.-my username is hilesp on the college server.

#!/usr/bin/perl

# NOTE: make sure you create a file called # log.html and place it in the appropriate # place on your server. # ALSO: you can access this script # with server side include by entering # <!--#exec cgi="/cgi-bin/counter.cgi"--> # into whatever page you want to log from. # Hope this gives you something to at least to start # with, enjoy! # M.M. computersmarts.net

print "Content-type: text/html\n\n";

##################################################### # This is the URL of where you image is located # ##################################################### $imageurl = "http://www.sbu.ac.uk/~hilesp/images/log.gif";

##################################################### # This is the PATH to where it will store the IP's # #####################################################

$logfile = "/~hilesp/sbu.ac.uk/www"; # NO FORWARD /

##################################################### # And here is the script in action # #####################################################