if ($_server[' http_x_forwarded_for ']) {
$onlineip =$_server[' http_x_forwarded_for '];
}elseif ($_server[' http_client_ip ']) {
$onlineip =$_server[' http_client_ip '];
}else{
$onlineip =$_server[' remote_addr '];
}
$onlineip =substrs ($ONLINEIP, 16);
Intercepting IP
function Substrs ($content, $length) {
if ($length && strlen ($content) > $length) {
$num = 0;
For ($i =0 $i < $length-3; $i + +) {
if (Ord ($content [$i]) >127) {
$num + +;
}
}
$num%2==1? $content =substr ($content, 0, $length-4): $content =substr ($content, 0, $length-3);
$content. = ' ... ';
}
return $content;
}
To analyze whether IP is in the list
function Cvipfrom ($IP) {
Global $ipa 0;
$d _ip=explode (".", $ip);
$f _n=file_exists ("./ipdata/$d _ip[0].txt")? "./ipdata/$d _ip[0].txt": './ipdata/0.txt ';
$ip =implode ('. ', D_ip ($d _ip));
$db =fopen ($f _n, "RB");
Flock ($db, lock_sh);
$d =fread ($db, FileSize ($f _n));
$s _ip= "\n$d_ip[0]. $d _ip[1]. $d _ip[2]";
if ($s =strpos ($d, $s _ip)) {
! ($f =s_ip ($db, $s, $ip)) && list ($l _d, $ff) =nset ($DB);
}else{
$s _ip= "\n$d_ip[0]. $d _ip[1]";
if ($s =strpos ($d, $s _ip)) {
! ($f =s_ip ($db, $s, $ip)) && list ($l _d, $ff) =nset ($DB);
}elseif ($s =strpos ($d, "\n$d_ip[0]") && $f _n== './ipdata/0.txt ') {
$s _ip= "\n$d_ip[0]";
! ($f =s_ip ($db, $s, $ip)) && list ($l _d, $ff) =nset ($DB);
}else{
$f = ';//ip not returned empty within the restricted list
}
}
if (Empty ($f) && $s!==false) {
while (Ereg ("^ $s _ip", "\ n". $l _d)!==false) {
if ($ipa 0==1 | | $f =s_ip ($db, $s, $ip, $l _d)) break;
List ($l _d, $CFF) =nset ($DB);
$CFF && $ff = $CFF;
}
}
Fclose ($DB);
Return $f? $f: $FF;
}
function S_ip ($db, $s, $ip, $l _d= ') {
Global $ipa 0;
if (! $l _d) {
Fseek ($db, $s +1,seek_set);
$l _d=fgets ($db, 100);
}
$ip _a=explode ("T", $l _d);
$ip _a[0]=implode ('. ', D_ip (Explode (') ', $ip _a[0)));
$ip _a[1]=implode ('. ', D_ip (Explode (') ', $ip _a[1)));
if ($ip < $ip _a[0]) $ipa 0=1;
if ($ip >= $ip _a[0] && $ip <= $ip _a[1]) return $ip _a[2]. $ip _a[3];
}
function Nset ($db) {
$l _d=fgets ($db, 100);
$ip _a=explode ("T", $l _d);
Return Array ($l _d, $ip _a[2]. $ip _a[3]);
}
function d_ip ($d _ip) {
For ($i =0 $i <=3; $i + +) {
$d _ip[$i] = sprintf ("%03d", $d _ip[$i]);
}
return $d _ip;
}
$ipfrom =cvipfrom ($ONLINEIP);
if (!empty ($ipfrom)) {//ipfrom IP source is not empty ... Prohibit access to display fuck you
Die ("Fuck You");
}
?>
[/code]
The above code steals to Phpwind 4.0. Ipdata please download yourself to phpwind.net ...
Phpwind used to show the user source, I do the opposite ... Add restricted IP directly within ipdata ...