CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
IP Tracker



Aug 2, 2000, 2:51 AM

Post #1 of 3 (2204 views)
IP Tracker Can't Post

I need a CGI/PL script that will enable me to print visitors IP address on my start page. Any help would be appreciated.



Aug 2, 2000, 3:23 AM

Post #2 of 3 (2204 views)
Re: IP Tracker [In reply to] Can't Post

If you know perl use this code

print "$ENV{'REMOTE_ADDR'}";

That will return the users ip address.

If you don't know perl and Are asking for the script,

in a file named ip.cgi

put this in it,

# make sure to change this to your correct path to perl
print "Content-type: text/html\n\n";
# in the below code put the variable $ENV{'REMOTE_ADDR'}
# in the html you want it to be presented in
print qq~

That's it, Simple program really.

Then upload it in ascii mode and change the permission to 755.

On the page you want it to print the ip address on name that page with a ".shtml" extension. so you'll have, file.shtml

This way you can use ssi (server side includes)

Now on the page with the extention

put this where you want the address to show up in the format you created in the cgi.

<!--#exec cgi="" -->

Also make sure the path is correct.

Then when you visit the page it should show.

If not, contact your server admin and ask them if ssi is turned on.

If you can't use ssi try using iframes.

<iframe src="" width=100 height=20 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no></iframe>

You can play around with the heights and widths to find a setting you like.

Well that should cover you.



Aug 2, 2000, 3:47 AM

Post #3 of 3 (2204 views)
Re: IP Tracker [In reply to] Can't Post

Cheers Perl. Words of wisdom from a master



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives