• michalas

    (@michalas)


    Well here’s the code I want to use to ban ips using php:

    <?php
    $banned_ip = array();
    $banned_ip[] = ‘123.123.123.123’; //specific
    $banned_ip[] = ‘222.222.222; //beginning with those 3 sets
    $banned_ip[] = ‘222.222’; //222.222.1.1, 222.222.242.142, etc.
    $banned_ip[] = ’25’; //let’s block anything beginning with 25

    foreach($banned_ip as $banned) {
    $ip = $_SERVER[‘REMOTE_ADDR’];
    if(0 === strpos($ip, $banned)) {
    header(“Location: “.”[URL TO SEND PEOPLE TO]”);
    exit();
    }
    }
    ?>

    I want to ban a user from all pages so I should put it in my header.php, right? Which part do I put it in? The <body> section? the <head>? or before the <html>? Where? Thank you. x

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Ips’ is closed to new replies.