Backend Development

IPLogger PHP

Submitted by bol, , Thread ID: 195345

Thread Closed
24-01-2021, 01:39 PM
#1
Hey
I made a pretty cool little IpLogger (uses geoip).
Either install it on your apache server, or use a web host like Stayhost which has already installed it. (need a geoip database)
For the user everything is normal, just a 404 Not Found,
you a small text file with simple information about the user:



[b]- Ip
- UserAgent
- Continent
- Pays
- Region
- Ville
- Code postal
- Latitude / Longitude
[/b]

[b]- Heure on la personne clique[/b]
[b]- FAI[/b]


PHP Code:
php
$user_ip 
'Ip Adress : ' $_SERVER['REMOTE_ADDR'] . "\r\n";
$user_useragent 'User Agent : ' $_SERVER['HTTP_USER_AGENT'] . "\r\n";
$user_clickdate date('d-m-Y H:i:s') . "\r\n";
$user_country 'Pays : ' geoip_country_name_by_name($_SERVER['REMOTE_ADDR']) . "\r\n";
$user_record geoip_record_by_name($_SERVER['REMOTE_ADDR']);
$user_fai 'FAI : ' gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\r\n";

// Ecriture dans le fichier info.txt des infos

$stockInfo fopen('info.txt''a+');

fputs($stockInfo$user_ip);
fputs($stockInfo$user_useragent);
fputs($stockInfo$user_clickdate);
fputs($stockInfo$user_fai);
foreach(
$user_record as $i => $value)
  {
    
fputs($stockInfo$i ': ' $value "\r\n");
  }
fputs($stockInfo,'-----------------' "\r\n");
fclose($stockInfo);
?>

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <meta http-equiv="x-ua-compatible" content="ie=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 <title>404 Not Found</title>
 <style type="text/css">
   .page {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  min-height: 100vh;
    }
  .main {
  -webkit-box-flex: 1;
  -ms-flex: 1 1 70%;
  flex: 1 1 70%;
  box-sizing: border-box;
  padding: 10rem 5rem 5rem;
  min-height: 100vh;
    }
  .error-code {
  color: #f47755;
  font-size: 8rem;
  line-height: 1;
    }
  p.lead {
  font-size: 1.6rem;
  color: #4f5a64;
    }
 </style>
</head>
<body>
<div class="page">
 <div class="main">
  <h1>Server Error</h1>
  <div class="error-code">404</div>
  <h2>Page Not Found</h2>
  <p class="lead">This page either doesn't exist, or it moved somewhere else.</p>
  <hr/>
</div>
</body> 

RE: IPLogger PHP

#2
Do not use $_SERVER['REMOTE_ADDR'], for example if someone is using Chrome for Android's "Lite Mode" you'll get Google's proxy IP address -- have a look at the $_SERVER['HTTP_X_FORWARDED_FOR'] if it exists (but do not forget to filter/escape it).

RE: IPLogger PHP

This post was last modified: 01-06-2021, 08:00 PM by alexvenne
#3
Great! But how does the tracking works? I want the behind the scenes? So you simply grab the External IP and hit the router whille hacking? what's next?












Showbox jiofi.local.html tplinklogin

RE: IPLogger PHP

#4
Yeah, I join to Perlish!

The REMOTE_ADDR doesn't work with Android and IOS phones/tablets. The HTTP_X_FORWARDED_FOR is an actual parameter for getting your visitor's IP.

Users browsing this thread: