problem with $REMOTE_ADDR

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

problem with $REMOTE_ADDR

Post by mzfp2 »

I guys

im having a problem with what the $REMOTE_ADDR variable returns, in some parts of my script it returns the IP address of my machine, but in other parts it returns nothing?

in the routines that uses it, ive tried making it global, and even identified it as global at the start of the script, but it seems in some functions it has a value, and some it doesnt

its very unpredictable, and only occurs when i upload the script to the unix server
rodrigocaldeira
Forum Commoner
Posts: 27
Joined: Wed Mar 05, 2003 6:40 pm
Location: Brazil
Contact:

Post by rodrigocaldeira »

use $_SERVER['REMOTE_ADDR']
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Using $_SERVER['REMOTE_ADDR'] means that you don't have to worry about declaring it global because the $_SERVER array is an autoglobal.

Mac
Post Reply