[PHP] getting the IP address off a visitor

2002-07-08 Thread Sebastian Marcu

Hi there,

I am new to PHP and need some help.
I was wondering if there is a way to get hold of the IP address of a site
visitor with PHP. I'm trying to develop an interaction where the server
would recognise a new visitor from a returning visitor via the IP address.

Regards,


Sebastian





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] getting the IP address off a visitor

2002-07-08 Thread Justin French

Hi,

Not a good idea.

1. in the case of most dial-up users with an ISP, the IP address is usually
dynamically assigned, so next time they dial-up (or re-connect) they will
more than likely have a different IP address.

2. in the many cases of computers with a static IP (cable/ADSL/etc), the IP
address does not necessarily represent a user... think about shared
computers in families, in libraries, corporations, net cafe's, etc.

3. Data storage -- eeek! If you get 1000 visitors with upto 15 bytes
(nnn.nnn.nnn.nnn) each, that's 15k of IP address' you have to search through
constantly, without any real way to make it quicker (eg indexing).  That may
not sound so bad, but perhaps when you reach 3 visitors, it's now upto
450k. Yuk.


Typically, return visitors are recognised with a cookie on the browser,
which definitely takes care of problem #3... of course it doesn't help with
problem #2 (shared computers).


Good luck,

Justin French


on 05/07/02 2:00 AM, Sebastian Marcu ([EMAIL PROTECTED]) wrote:

 Hi there,
 
 I am new to PHP and need some help.
 I was wondering if there is a way to get hold of the IP address of a site
 visitor with PHP. I'm trying to develop an interaction where the server
 would recognise a new visitor from a returning visitor via the IP address.
 
 Regards,
 
 
 Sebastian
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] getting the IP address off a visitor

2002-07-08 Thread Chris Hewitt

Sebastian,

Yes, look at the data returned by running phpinfo() and you will see it. 
As discussed very recently on this list, an IP address is not a good way 
to determine whether this is a new user or not. I suggest you look in 
the recent archives for the discussion on this topic.

HTH
Chris

Sebastian Marcu wrote:

Hi there,

I am new to PHP and need some help.
I was wondering if there is a way to get hold of the IP address of a site
visitor with PHP. I'm trying to develop an interaction where the server
would recognise a new visitor from a returning visitor via the IP address.

Regards,


Sebastian








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] getting the IP address off a visitor

2002-07-08 Thread Miguel Cruz

On Mon, 8 Jul 2002, Justin French wrote:
 1. in the case of most dial-up users with an ISP, the IP address is usually
 dynamically assigned, so next time they dial-up (or re-connect) they will
 more than likely have a different IP address.
 
 2. in the many cases of computers with a static IP (cable/ADSL/etc), the IP
 address does not necessarily represent a user... think about shared
 computers in families, in libraries, corporations, net cafe's, etc.
 
 3. Data storage -- eeek! If you get 1000 visitors with upto 15 bytes
 (nnn.nnn.nnn.nnn) each, that's 15k of IP address' you have to search through
 constantly, without any real way to make it quicker (eg indexing).  That may
 not sound so bad, but perhaps when you reach 3 visitors, it's now upto
 450k. Yuk.

Well, an IP address is only 4 bytes, and they can be sorted and indexed, 
but otherwise I completely agree with your points. Using IP addresses to 
recognize people is doomed to failure.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php