Forum Moderators: coopster

Message Too Old, No Replies

simple variable help with ip address

         

bobnew32

7:59 pm on Jul 3, 2003 (gmt 0)

10+ Year Member



Ok im trying to assign the variable $ip_address the ip address of the user.

So, I try to do

<?php
$ip_address= '<!--#echo var="REMOTE_ADDR" -->';
?>

And of course it doesn't work like that so I try switching it around and I keep getting errors. Plz help, thx.

brotherhood of LAN

8:01 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<?php
$ip_address = $_SERVER['REMOTE_ADDR'];
?>

AFAIK if you have an older version of PHP you will need to change $_SERVER to $HTTP_SERVER_VARS.

jatar_k

9:19 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Introduced in 4.1.0. In earlier versions, use $HTTP_SERVER_VARS.