How to track the IP of visitors in your website without any plugin or script?
We all know that using lots of unnecessary plug ins and scripts will slow down our site performance, or may cause internal server error (if you are on shared web hosting chances of showing 500 Error is quite high). That’s why its always advised to not to use unnecessary plug ins and scripts on your site/blog. Today I’m gonna tell you how to track the IP address of visitors in your website without any plug in or script.
< ?php
$ipaddress = $_SERVER['REMOTE_ADDR'];
$date = date ("M dS H:i:s");
$message = "$page _ $ipaddress _ $date\n";
$File = "track.txt";
$Open = fopen($File, "a+");
if ($Open){
fwrite($Open, "$message");
fclose ($Open);
}
?>
You can easily track IP address of visitors in your website by just adding this PHP code, the IP’s tracked are saved in a log file named “track.txt” in the server. After adding this PHP code make track.txt page writable by PHP.
Related Posts:
Today when I was checking one of my friends blog came through an interesting article on round up posts. I read it, a ...
Hello everyone! This is Dinesh here (Ankit's friend) and this is my first post on Extreme Trix, today I am going to ...















Well you have to change the access permissions for track.txt as writable.
@ Tech @ InkAPoint : Oh sorry I forgot to mention that…thanks
Hi,
Found your trix here and want to try it. However, I ask you to excuse me, for I am just starting this WordPress journey. Exactly where does the “track.txt” file go? I placed your code near the bottom of the index.php. Do you have another suggestion?
Thanks again,
Alex