Rate this article

How can I detect the users IP address

Rating: 0.0/5 (0 votes cast)

You can use one of the following:

<?php
echo 'Your IP is: ' . $_SERVER['REMOTE_ADDR'];
?>

OR

<?php
echo 'Your IP is: ' . getenv('REMOTE_ADDR');
?>

You will probably use the information somewhere so it might be better to set a variable

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

Adobe

XMS Systems
Free PositiveSSL and WhoisGuard with Every Domain Purchase
ionCube Online PHP Encoder

Although we try to ensure all the articles submitted are valid it is your responsibility to make sure you have backups before you use these suggestions on your pc or websites.
We do not take any responsibility for any data-loss, loss in functionality or any problem that might arise in what-ever way or form by making use of the information on this site.

"Friends of Interakt" has no connection to the Adobe Interakt Company