
perlkid
stranger
Aug 2, 2000, 3:23 AM
Post #2 of 3
(587 views)
|
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, #!/usr/bin/perl/ # 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~ $ENV{'REMOTE_ADDR'} ~; exit; 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="http://www.site.com/cgi-bin/ip.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="http://www.site.com/cgi-bin/ip.cgi" 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. perlkid
|