1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
$schcidr="192.168.0.0/16"; $ip=$_SERVER["REMOTE_ADDR"];
function ($ip, $range){ list ($subnet, $bits) = explode('/', $range); if ($bits === null) { $bits = 32; } $ip = ip2long($ip); $subnet = ip2long($subnet); $mask = -1 << (32 - $bits); $subnet &= $mask; return ($ip & $mask) == $subnet; }
if(cidr_match($ip, $schcidr) or empty($ip)){ $fname = "/u/www/travel/b2c/addfile/citytest/".date('Y-m-d').".html"; $fd=fopen($fname,"w"); fwrite($fd,$showdata); fclose($fd); if(file_exists($fname) && substr(decoct(fileperms($fname)), 2) != '0646') chmod($fname, 0646); } ?>
|
近期评论