I'm in need of a script, which ensures that each user, when logged in, cannot load more than 2 pages per second; if he does, he should get some error message.
What would be the smartest and most efficient/resource-saving way of achieving this limitation?
Limit pageloads per second
Moderator: General Moderators
Re: Limit pageloads per second
Store a timestamp array (microtime()) of the pages visited in the session. If the current page has been visited more than twice in the last second, redirect to an error page instead.
Re: Limit pageloads per second
That sounds pretty heavy on the database.. I have ~5 million pageviews per day..
Re: Limit pageloads per second
Where did you see database mentioned? I said in the session..