Advertisement
CreadPag

Sacar IP

Dec 11th, 2013
1,553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2.  
  3. <body>
  4. <?php
  5. $ip = $_SERVER['REMOTE_ADDR']; //IP
  6. $meses = array('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'); //Meses
  7. $nombre = 'logs'; //Nombre de archivo
  8. $dia = date('d'); //Dia
  9. $mes = date('m') - 1; //Mes
  10. $ano = date('Y'); //Año
  11. $hora = date('h:i:s'); //Hora
  12. $file = fopen($nombre.'.txt', 'a+'); //Abrimos archivo
  13. fwrite($file, 'La IP '.$ip.' accedio el '.$dia.' de '.$meses[$mes].' del '.$ano.' a las '.$hora.""); //Guardamos información
  14. fwrite($file, "\r\n======================================================================". PHP_EOL);
  15. fclose($file);//Cerramos archivo
  16. ?>
  17. </body>
  18. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement