![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
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:
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: May 2005
Location: UK
Posts: 1,201
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,063
|
select whatever from table where time>=date_sub( now() ,INTERVAL 1 DAY)
should give you your activity in the last 24 hours .
__________________
All cookies cleared! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |