Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Open Source > Perl
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Perl section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2007, 03:40 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default how to get the IP address of the user viewing site

does anyone know how to get the IP address of the user that is viewing my script?
can I use CGI??

Picco

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old April 27th, 2007, 10:10 AM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey Picco,

You should be able to use:

Code:
my $ip = $ENV{'REMOTE_ADDR'};
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk
 
Old April 30th, 2007, 06:51 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks again Charlie, this is what I was doing:
Code:
sub crmdebug {

    my $str = shift;
    my $del = shift;

    return undef if ($ENV{'REMOTE_ADDR'} !~/85\.189\.67\.113/);

    if ($del eq "y") {
        system("rm -f /home/picco/errors/GlasgowRangersFC.log");
    }
    open(LOG, ">>/home/picco/errors/GlasgowRangersFC.log");
        print LOG localtime(time) ."\n";
        print LOG "$str\n";
        print LOG "+++++++++++++++++++++++++\n";
    close(LOG);
}
www.crmpicco.co.uk
www.ie7.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
IP address of the user. 99mary BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 26th, 2007 09:23 AM
Help me i must Get IP Address pla_2 C# 2005 2 October 12th, 2006 07:51 AM
How to get IP Address of the User Machine pkdev Classic ASP Basics 2 April 10th, 2004 01:44 PM
Retreiving IP address & gateway address sjangit VBScript 0 February 3rd, 2004 02:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.