)BIG"B"Affleck 15 Master Poster Banned

Ok here you go for the "tip of the month" Could not think of where to post but not like I care if it ended up in the wrong one. But here it goes
Block a IP with a special message Gal

  • This could also be used to allow only your IP to this sctipt, just put an echo() there
  • the die() is, and add an }else{ die() You can also use $blockip
  • as a wild card, meaning if $blockip = 192.168 it would block the any IP that started
  • with, or contianed 192.168 You can block all IP's with if you set * 1=>'.'); Ofcourse
  • to ban the IPs you want to ban change 0=> and 1=> to the IP's you want to
  • ban, you can also add more like 3=> 4=> all the way up.

    <?php
    $blockedips = array(0=>'127.0.0.1',1=>'192.168.2.1');
    for ($i=0; $i<sizeof($blockedips); $i++) {   if (strstr($_SERVER["REMOTE_ADDR"], $blockedips[$i])) {     die("Sorry. You have been banned."); }}// Put everything else here.echo "Everything."
    ?>
    

Say you wanted to ban the IP's 85.2.15.148, 218.21.4.65, 84.21.81.6 and 78.21.26.222. The array would look like this...

Merry Christmas.............

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.