How to log IP of Victim using Web page? Ip Logger[Method 1]

So far, i have give some third party websites to track ip address of victim.  Today we are going to create our own website or webpage to track victim IP address.  I have written this PHP code for you.

Let me explain in two different methods
Method 1:
Log ip and redirect to some other interesting webpage(like “cute kittens pictures” page) or trusted page (like “facebook” page).

Method 2:
Log the ip and remains in same page( without redirection). I think “you won’t select this method.

In this post , i will explain the method 1.


  • Any free hosting site and basic knowledge about file uploading to hosting.
  • url shortening sites account like,[optional]

Method 1-IP log php code: 

Step 1:
Create account in any free web hosting service.

Step 2:
Open notepad++ or notepad (if you have notepadd++, it will better to edit).
Paste the following code:


fwrite($f,“IP Address:”.$_SERVER[‘REMOTE_ADDR’].”n”);
fwrite($f,“User Agemt:”.$_SERVER[‘HTTP_USER_AGENT’].”n”);
fwrite($f,“Host Name:”.php_uname(‘n’).”n”);
fwrite($f,“Operating System:”.php_uname(‘v’).”(“.php_uname(‘s’).”)”.“n”);
//provided by


and save it as index.php

Code Explanation:
If you don’t want to know how it is logging the IP, you can skip to the step 3.

header(“Location:index1.php”); this will redirect to index1.php page.
 You can specify any other location instead.  For example, if you want to redirect to ,then change the code as
$f=fopen($file,‘a’);  opens the file iplog.txt in append mode( add the contents at the end of file)and store the pointer in variable f.

fwrite($f,string) will write the string into the file(iplog.txt) for example, if the string is “hello”, it will be stored inside iplog.txt file.

so fwrite($f,“————————-“.”n”); will insert ———– inside the iplog.txt

fwrite($f,“IP Address:”.$_SERVER[‘REMOTE_ADDR’].”n”);
here $_SERVER[‘REMOTE_ADDR’] is build function ,returns IP address(if you run locally in your pc using wamp/xampp, it will return So after ———- lines, the “Ip address:” will be append.

Now the iplog.txt file contains:

IP Address:

$_SERVER[‘HTTP_USER_AGENT’] returns the current user agent used by victim.  It will contains information about the browser details(mozilla 3.6,ie),operating system(xp,linux).

php_uname(‘n’) returns the Host name .  Now the iplog.txt contains

IP Address:
User Agent: Mozilla (linux) (ubuntu 11.10) Mozilla3.6

fclose($f); will close the opened file.

Step 3:
Open notepad and save the file as “iplog.txt”

Step 4:
again open the notepad and create your own php or html page. It should be some interesting contents(download any website templates,rename the index.html file to index1.html).
Example 1(html):

<img src=”cutekittens.jpg”/>

save the file as index1.html.
Example 2(php):

<title><?php echo “Cute kittens”; ?></title>
 <img src=”cutekittens.jpg”/>

 save the file as index1.php

Step 5:
Now you have 3 files namely index.php,index1.php,iplog.txt.
Upload these files to your hosting.

File uploaded to hosting account

set iplog.txt permisson to read and write by global.

Set file permission for iplog.txt

Step 4:
Check whether it is working or not by visiting the your hosting sub domain account.
For example:
if you enter the url, it will redirect from index.php to index1.php.
Now open the iplog.txt.  There you can see the logged information.

Step 5:
Send to your friend or victim with attractive mail content and title. At the end, ask him to visit the link to know more about the info.

Redirected to index1.php
Logged Details ,stored in iplog.txt file

Once he visit the link, his IP address is in your hands.