If you need to check if the current user's IP address is either within a set range or matches a given IP use this function. Possible uses include additional security for an authentication script. IP range needs to be in form 12.34.56.78-12.34.67.89
Download
View Source (print view)
Rating : 4.7
Views : 354
function checkIPorRange ($ip_address) {
if (ereg("-",$ip_address)) {
// Range
$ar = explode("-",$ip_address);
$your_long_ip = ip2long($_SERVER["REMOTE_ADDR"]);
if ( ($your_long_ip >= ip2long($ar[0])) && ($your_long_ip <= ip2long($ar[1])) ) {
return TRUE;
}
} else {
// Single IP
if ($_SERVER["REMOTE_ADDR"] == $ip_address) {
return TRUE;
}
}
return FALSE;
}
php script" class="neww" target="_b, how to use this code, php_tools, yahoo_status_shopping_cart.php, php file upload, shopping_cart and user=0--, drop down, mysql_commit, forum, shopping_cart', backup, updateoraddimagesonpages, rtttl to 8 bit source code, stefan_hornea, rent_and_0=1_union_select, how to run php, php_script"_class="neww"_target="_blank"_title="im_neuen, embed_snippets, farah_aead, sql incection, antoine anik