Something simple

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
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Something simple

Post by ol4pr0 »

Code: Select all

$ip = $REMOTE_ADDR;
$host = $REMOTE_HOST;

$message =  "ip: $ip Host: $host ";
problem:
Notice: Undefined variable: REMOTE_HOST
Anybody got the fix ?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

$_ENV['remote_host'];
fixed my problem ;-)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You could also use the $_SERVER array, which is where most of those variables are since PHP 4.1 (it's a register_globals thing) - $_SERVER['REMOTE_HOST'] and $_SERVER['REMOTE_ADDR'].

Mac
Post Reply