[PHP] Obtener la IP de un visitante web y guardarla en txt

Cualesquiera sin subforo propio
Post Reply
InnerCity
Administrador
Administrador
Posts: 115
Joined: Mon Jan 05, 2004 12:00 am
Contact:

[PHP] Obtener la IP de un visitante web y guardarla en txt

Post by InnerCity » Sun Mar 26, 2006 2:57 pm

Code: Select all

<?php

if(getenv(HTTP_X_FORWARDED_FOR)) { $getip = getenv(HTTP_X_FORWARDED_FOR); }
elseif(getenv(HTTP_CLIENT_IP)) { $getip = getenv(HTTP_CLIENT_IP); }
else { $getip = $REMOTE_ADDR; }
$fp = @fopen("ip.txt", "a");
fputs($fp, " IP:".$getip);
fclose($fp);
echo "Tu ip publica es: <h1> $getip </h1>";

?>

Post Reply

Return to “OTROS”

Who is online

Users browsing this forum: No registered users and 0 guests