Need cgi script to log ip addresses
|
Original Message
|
Name: Calvin
Date: June 24, 2003 at 11:33:07 Pacific
Subject: Need cgi script to log ip addresses OS: xp CPU/Ram: 800/256
|
Comment: Hey, Does anyone here know of where I can get a free Cgi script to log ip addresses of people that go to my website? Any ideas or thoughts would be great! - Thanks
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: bitbyte
Date: June 24, 2003 at 11:54:35 Pacific
Subject: Need cgi script to log ip addresses
|
Reply: (edit) if your provider supports php then make it with php, its quite easy, if you need help, i can give you a script
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Infinite Recursion
Date: June 24, 2003 at 12:08:02 Pacific
Subject: Need cgi script to log ip addresses |
Reply: (edit) Here is a script I use below... it takes all of the environment variables, including IPs and writes them out to file. It is Perl/CGI.
Hope it helps. Infinite Recursion ----------- #!/usr/bin/perl # This is a PERL program to display all of # the UNIX environment variables and their # current values # print "Content-type: text/html\n\n"; print ""; print ""; print "Environment Variables"; print ""; print ""; open (OUT, ">> systems.txt"); print OUT "------------ START --------------\n"; $thedate = (system("date >> systems.txt")); print OUT "\n"; foreach $key (sort keys %ENV) { print OUT $key, " = ", $ENV{$key}, "\n"; } print OUT "--\n\n"; close (OUT); print ""; print "";
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: bitbyte
Date: June 24, 2003 at 13:14:44 Pacific
Subject: Need cgi script to log ip addresses
|
Reply: (edit) <? $fd=fopen ("logfile.txt","a"); fputs ($fd,"$REMOTE_ADDR - ".gethostbyaddr ($REMOTE_ADDR)." - $HTTP_USER_AGENT - $HTTP_VIA\r\n"); fclose ($fd); ?>
with this script you get ipadr hostname useragent from which page the people come
use this script in your indexfile it must be index.php create a file called logfile.txt and set the correct permissions that php can write to the file thats all
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: