I have a problem that I think is easy to solve, but I do not know how to solve it.
Below is a script to record who accessed the page. It worked fine, but it overrides one access on top of the other, and I need every IP that it accessed to be saved, one underneath the other.
I also do not know how to set the time, it is appearing with 5 hours more.
<?php
/* se o arquivo não existir, será criado, dê
permissão 777 na pasta onde ele será criado */
$arquivo = "includes/spy.txt"; // arquivo que gravará os dados
$data = date("d/m/Y H:i:s"); // Data do acesso
$ip = $_SERVER['REMOTE_ADDR']; // IP de acesso
$host = getHostByAddr($ip); // Host de acesso
$pagina = $_SERVER['PHP_SELF']; // Página de acesso
$browser = $_SERVER['HTTP_USER_AGENT']; // Browser de acesso
$fp = fopen($arquivo, "w+");
fwrite( $fp,
"Data: $data | IP: $ip | host: $host | Pagina Acessada: $pagina | Navegador: $browser"
);
fclose($fp);
?>