I want to generate an error message that says "Sorry visitor, You're only allowed to do 25 mysql lookups per hour on our XYZ table!":p
Well, I already have a table called "XYZ" which my visitor wants to query. But I don't want them querying it more than 25 times an hour.....
So I'm guessing that I need ANOTHER mySQL table to hold 3 things:
1.) the visitor's IP address.
2.) the stuff the visitor is trying to look up
3.) a timestamp, so we can count the queries per hour
CREATE TABLE Limit_this_Visitor (
Visitors_IP_address varchar(20) NOT NULL,
Stuff_Visitors_Lookin_Up varchar (20) NOT NULL,
What_Time_it_is timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
);
So my question is: what's the PHP code that will check the new table (the "Limit_this_Visitor" table), and count how many queries a specific visitor from a specific IP address has looked up within the past hour. If less than 25 queries, then great: go ahead and do the lookup in the main XYZ table! However, if MORE than 25 queries, generate that error message.
I KNOW this seems like a really complicated question, but I don't know how else to make it simpler.😕 I've tried researching this on the net, but can't seem to find an answer. I know this type of "limiter" script is used a lot -- e.g. "sorry, you can't post more than 5 comments per day," or, "sorry, you've entered the wrong password too many times, come back tomorrow, etc."
Thank you!!🙂