Here is a code that will ban users with the specified ip, or multiple IP's in PHP, this goes at the very top if you want to prevent them from viewing:
1. Single IP:
<a href="http://ipost2host.com/viewtopic.php?f=14&t=1719#" target="_blank">
</a>Block IP range:Code:<?php function block_ip($ip){ if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip)) == $ip){ return true; } else { return false; } } // check if ip is blocked if (block_ip("123.456.789.987")){ echo 'go away'; exit; } ?>
<a href="http://ipost2host.com/viewtopic.php?f=14&t=1719#" target="_blank">
</a>Instead of blocking 1, you can lso use this instead of if:Code:<?php function block_ip($ip){ if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip)) == $ip){ return true; } else { return false; } } // check if ip is blocked if (block_ip("123.456.") or block_ip("123.457.")){ echo 'go away'; exit; } ?>
<a href="http://ipost2host.com/viewtopic.php?f=14&t=1719#" target="_blank">
</a>notice how it has an or then the same code again, so you may block mulitle IP addressesCode:if (block_ip("123.456.") or block_ip("123.457.")){


LinkBack URL
About LinkBacks

Reply With Quote

Bookmarks