How to define the visitor's ip

How to define the visitor's ip

Sometimes is required to learn who when from what IP address he visited your Internet resource. Such detailed information can be obtained, having installed the simplest scripts on the page of your website.

It is required to you

  • - The PC with the installed Windows operating system;
  • - Internet access.


1. Use the free counter of attendance the Internet of resources. Follow the link, find information on the one who visited your website and study the provided data. Set the code of the counter on your website and receive the necessary information about the users staying on your resource. It is possible to resort to services of the service located at the address which has similar characteristics. But in this case there are no guarantees that the reference added on the website will not lead to the unfair sniffer which is engaged in theft of confidential information at users.

2. If at you have no credibility third-party services, organize and systematize accounting of the IP addresses of visitors of your website directly on him. Insert on a page, after the closing tag / HTML, the code:
$ip=getenv (""REMOTE_ADDR"");
$date=date (""d M Y, H: i:s"");
$agent=getenv (""HTTP_USER_AGENT"");
$str= ("
Data - $date
Ip - $ip
Browser - $agent

$log = fopen (""base.php"" "", a+ "");
fwrite ($log,"" \n $str \n"");
fclose ($log);
also learn who stayed on your resource.

3. By means of this code written in the PHP language you learn about time of visit of your website. Obtain information on the web browser used by the guest and on its IP address. All these data are written in the text file base.php. For its creation open the Notepad program, activate in it the empty text file and save it in the form of base.txt. In a file name replace the txt extension with php and lay out it in a root directory. Enter in браузере:_http://адрес_вашего_сайта/base.php and check who visited your site. To make the information of the file with reports confidential, enter a line in its form: "You have no access to this file'; exit;?>".

Author: «MirrorInfo» Dream Team