phpbar.de logo

Mailinglisten-Archive

AW: [php] Die AOL user und deren proxies...

AW: [php] Die AOL user und deren proxies...

"Meißner, Heinz" HMeissner at dgverlag.de
Fre Mar 26 10:54:52 CET 2004


> Also meine frage war ja jetzt ob AOL und die anderen grossen 
> proxies sowas
> wie diese werte mitsenden?
> $_SERVER["HTTP_X_FORWARDED_FOR"];
> $_SERVER["HTTP_CLIENT_IP"];
hi michael,
also ich benutze so was:
IP hinter PROXY:
<?php
function fetchip() {
//get useful vars:
$client_ip = $_SERVER['HTTP_CLIENT_IP'];
$x_forwarded_for = $_SERVER['HTTP_X_FORWARDED_FOR'];
$remote_addr = $_SERVER['REMOTE_ADDR'];

// then the script itself
if (!empty ($client_ip) ) {
    $ip_expl = explode('.',$client_ip);
    $referer = explode('.',$remote_addr);
    if($referer[0] != $ip_expl[0]) {
        $ip=array_reverse($ip_expl);
        $return=implode('.',$ip);
    } else {
        $return = $client_ip;
    };
} elseif (!empty($x_forwarded_for) ) {
    if(strstr($x_forwarded_for,',')) {
        $ip_expl = explode(',',$x_forwarded_for);
        $return = end($ip_expl);
    } else {
        $return = $x_forwarded_for;
    };
} else {
    $return = $remote_addr;
};
unset ($client_ip,$x_forwarded_for,$remote_addr,$ip_expl,);
return $return;
};
?>
das iefert mir bei AOL USERN (selber einer:-)
aol.com
auch wenn er über den zugang (bei mir in ffm) patched
teste es einfach mal
grüße
heinz

php::bar PHP Wiki   -   Listenarchive