Snippet Name: Anti-Flood Protection
Description: This script will redirect the user when he or she makes too many requests on your site.
Paste this code at the very beginning of your header code, above any MySQL connections or other PHP code.
Also see: » Censor Message Text
» Vulnerability Tester
» Block IP Addresses
» Ban Proxy Servers
» Bad Word Filter
» Anti-SQL Injection Function
» XSS Sanitizer Function
» Filter non-alphanumeric characters
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009
|
<?PHP
IF (!ISSET($_SESSION)) {
SESSION_START();
}
// anti flood protection
IF($_SESSION['last_session_request'] > TIME() - 2){
// users will be redirected to this page if it makes requests faster than 2 seconds
HEADER("location: /flood.html");
EXIT;
}
$_SESSION['last_session_request'] = TIME();
?> |