PHP网站和用户提出了很多要求[关闭]

I have a website (PHP).I don't have authentication system. How i can check if user make a lot of request to my server, And ban his IP address. Or if there is a better way to protect my website from bot (scraper)

It would depend on the server you're using. User IP addresses are most commonly stored in the server logs. You'll usually find this at /var/www/html/access_log or something like that. At that point you will be able to grep the log for reoccurring IP addresses and add them to a block list either in an .htaccess file or at the router level.

You can log the time in a file with the name as the users IP address:

127.0.0.1.txt

7/7/16 10:55:26

Before allowing the request, check to see if the last time they connected was within 5 (or any amount of) seconds. Then deny access and add them to a blacklist.

if you want to do on php side: create a database with 2 fields: ip (key), and counter

INSERT INTO table (ip,count) VALUES ([ip comes here],1)
ON DUPLICATE KEY UPDATE count=count+1;

after that you can implement an error site, if counter reach a number