![]() |
PHP? Count number of times id shows up in 24 hours (based on timestamp)
I want to limit the amount of times someone uses whatstheirip.com to 25 times per 24 hours instead of 25 times total (which I put in temporarily because it was easier for me to program)
My timestamp looks like this 2012-04-29 02:13:33 I used to have a script like this but I don't think it ever worked = PHP Code:
|
what about something like
SELECT UserName, Count(UserName) AS SumOfUses FROM table WHERE Date(`time`) = CURDATE() AND UserName = '[email protected]' Not the last 24 hours, but the number of uses today |
select whatever from table where time>=date_sub( now() ,INTERVAL 1 DAY)
should give you your activity in the last 24 hours . |
If you have, or start getting, heavy traffic, it can be done about a thousand times more efficiently using a leaky bucket like Throttlebox does. If you have have hundreds of hits a day it doesn't matter. When you get hundreds of hits per minute it matters a lot.
If you want to show some other interesting information, we have a similar script we used for investigations. In one case the script alerted us that he had just checked the link from the public library, so we ran down to the library before he left and took care of business. |
All times are GMT -7. The time now is 10:58 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123