I want to create a DDoS prevention script, but I don't know which is the best way to go about it.

What I was thinking is that, when a user attempts to connect to the website, it records their IP and then if there is loads of traffic, it then kicks them off the website?

Also, is there a way in PHP that you can check to see which packets are being sent to the server, and, if there is a large amount of packets coming into the server it then refuses entry?


check user ip how many times it access to your website then try to use captcha