invalid ip blocker script not work on my page!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    invalid ip blocker script not work on my page!

    I am trying to put my invalip ip blocker script in my php page. But it,s not working! Plz help me to do it for best. I put these code on my page of site!
    <?php
    $ip=$_SERVER['REMOTE_ADDR']; function validateIP($ip)
    {
    $regexp = "([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})";
    $validate = ereg($regexp, $ip);
    if ($validate == true)
    {
    return true;
    }
    else
    {
    return false;
    };
    ?>
    plz help me to solve this problem. Thank you!

    #2
    Deprecated ereg. Just read posted threads, its solved many, many times.
    PHP Code:
    function validateIP($ip) {
    if (
    preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/D'$ip)) {
    return 
    true;
    } else {
    return 
    false;
    }

    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

    Comment

    Working...
    X