As the ddos & syn flood would be attacking at the table level, i highly doubt the php script would be that effective at stopping it, why dont you post the link to what you seen here.
As snakes has said, a PHP script would be ineffective against a DDoS (Distributed Denial of Service) attack, as a DDoS simply floods the server with requests. If the client gets to the PHP script, they've already gotten a response from the server, thus, have already "attacked once".
The script you pointed to only stops the script from querying the server. But the fact remains that the server has responded to the request by the client.