Getting User’s IP in PHP

Written by admin on May 17th, 2008 in PHP Tutorials, Tutorials.

Sometimes you may need to get a users IP that is browsing your website and store it for protection or display it to the user.

In PHP this is simply done by using the $_SERVER variable.

The code below will store a users IP into a variable:

<?php

$UsersIP = компютри$_SERVER[’REMOTE_ADDR];

?>

REMOTE_ADDR simply grabs the remote IP Adress being used.

Lots more info can be obtained this way. But that is how to grab a Users IP.

Leave a Reply

You must be logged in to post a comment.



Site Navigation SEO Services