Saltar al contenido
Underc0de /foro

[PHP] Logs de ip en .txt

Iniciado por ANTRAX, Febrero 24, 2010, 11:26:14 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Avatar de ANTRAX
Febrero 24, 2010, 11:26:14 AM Ultima modificación: Marzo 27, 2014, 06:12:42 PM por Expermicid

bueno, emmm vamos de 1 al code no tengo ganas de hablar xD

[index.php]

Código: php

<title>Te vamos a leer la ip ^^</title>
<center><code><h1>You re Loged ^^</h1></code></center>
<br>
<?php
include("logs.php");
?>


[logs.php]
Código: php

<?php
$fo=fopen("archivodelogs.txt","a") or die("no esta el archivo xD");
$ip=$_SERVER[REMOTE_ADDR];
$host=gethostbyaddr($ip);
$d=date("d-m-Y");

fputs($fo,"$d $ip $host");
fputs($fo,"\r\n");
fclose($fo);

?>
WhatsApp Telegram


2 respuestas

Avatar de _katze_
$host=gethostbyaddr($ip);

agregale esto asi agregue el host tmb es una forma ahy varias

Avatar de Jhonjhon_123
Codigo Corregido, arreglados muchos fallos.

Se nota el copy and paste.
Los enlaces son solo para miembros. Registrate o iniciá sesión

¿Te quedó una duda sobre Back-end?

Preguntala y te responde la comunidad (y el asistente Underc0de IA si nadie llega antes). Es gratis y tarda un minuto.

Ya tengo cuenta
Guardamos tu pregunta en este navegador: después de entrar la publicás con un clic.
Grupo de WhatsApp