View unanswered posts | View active topics It is currently Sun Aug 07, 2022 9:06 pm



Reply to topic  [ 2 posts ] 
 IP Capture? 
Author Message
Junior Member

Joined: Thu Aug 21, 2003 1:33 pm
Posts: 1
Post 
Ok, I got a tough one for you experts.

I'm working on a shopping cart and need to be able to capture the IP address of the visitor and log them in automatically. The IP address will be stored in a database along with an associated store number which will function as the username.

How do I write this? Please be detailed because I'm fairly new to PHP.

Thanks in advance.


Thu Aug 21, 2003 1:38 pm
Report this post
Profile
Junior Member

Joined: Thu Aug 21, 2003 1:15 pm
Posts: 1
Post 
I wouldn't reccomend tracking by IP addresses but rather cookies. (Dynamic IPs for one reason...)

However, just to elucidate you, the user's IP address is found in the $_SERVER or $HTTP_SERVER_VARS array (the latter is deprecated as of PHP 4.1.0, when the former is first available) under the key REMOTE_ADDR. $REMOTE_ADDR will work with register_globals set, though this is not particularly recommended, and as of PHP 5.0.0, $HTTP_SERVER_VARS will not work if register_long_arrays is set to false.

See: http://us4.php.net/manual/en/reserved.vari...ariables.server


Thu Aug 21, 2003 7:42 pm
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.