Anti flood script
This script will redirect the user when he/she makes too many requests on your site.
A server can print message "warning: too many connections" if a users makes too many requests in a short period of time, then other users will not be able to view your site, this is a very common problem.
Paste this code at the very beginning of your header code, above any MySQL connections or other php code:
<?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();
?>
Make sure your destination page "flood.html" doesn't contain any mysql connection code or other code that might overload the server, a plain page is best. Place a note on it like "please wait 2 seconds between requests".