I was wondering how we can simply ignore (block) the flood atacks to our servers and i think that this solution is useful.

It checks if there is more than 1 request in 5 seconds. Of course you can change the time limit to 1 sec or 60 sec. It depends on this what you want.

So here is the script

<?php
    if (!isset($_SESSION)) {
        session_start();
    }
    // anti flood protection
    if($_SESSION['last_session_request'] > time() - 3){
        // users will be redirected to this page if it makes requests faster than 5 seconds
        header("location: /flood.html");
        exit;
    }
   
    $_SESSION['last_session_request'] = time();
?>

I hope it will be useful for everyone who wants to block the flood.