Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/07/2010, 10:11
Avatar de ciscoh4x0r
ciscoh4x0r
 
Fecha de Ingreso: junio-2010
Ubicación: Londres, Inglaterra
Mensajes: 300
Antigüedad: 13 años, 10 meses
Puntos: 12
Respuesta: [Peticion] Obtener IP real y no del proxy

Te explico, los proxys hay transparentes, anonimos, etc, la mayoria de los proxys se puede saber su IP real, por el hecho de ser inseguros o gratuitos.


Por ejemplo:
Código PHP:
Ver original
  1. 1. if ($_SERVER) {  
  2.    2.    if ( $_SERVER["HTTP_X_FORWARDED_FOR"] ) {  
  3.    3.        $realip = $_SERVER["HTTP_X_FORWARDED_FOR"];  
  4.    4.    } elseif ( $_SERVER["HTTP_CLIENT_IP"] ) {  
  5.    5.        $realip = $_SERVER["HTTP_CLIENT_IP"];  
  6.    6.    } else {  
  7.    7.        $realip = $_SERVER["REMOTE_ADDR"];  
  8.    8.    }  
  9.    9. } else {  
  10.   10.     if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {  
  11.   11.        $realip = getenv( 'HTTP_X_FORWARDED_FOR' );  
  12.   12.     } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {  
  13.   13.        $realip = getenv( 'HTTP_CLIENT_IP' );  
  14.   14.     } else {  
  15.   15.        $realip = getenv( 'REMOTE_ADDR' );  
  16.   16.     }  
  17.   17. }

Este funciona con proxys transparentes donde la variable $realip es la ip real del usuario
__________________
Algún día habrá una persona mejor que yo, pero esa persona no eres tú, ni ese momento es ahora...