Save the IP address of visitors of your site
Record the IP address of visitors to your site
If you are a victim of an attack or an attempted hack, it may be useful to know who
connected on the pages of your site at sepecific hours.
How do I save these addresses?
It is neede that you open/write a page on your site, and write these addresses between the tags
?> <php and commentary.
<php
$file = fopen("index.php", "r+");
?>
This will open the index.php page for writing.
Example:
If you define the date and time with the "date ()", here is the code:
<?php
$file = fopen("index.php", "r+");
fputs($file, "<php //$_SERVER["REMOTE_ADDR"] connected $numday $month $year at $hour h $minutes ?>\n");
fclose($dest);
?>
$_SERVER["REMOTE_ADDR"] is an environment variable that contains the IP address of the visitor.
With this script, each IP connecting to your site will be saved.