GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP? Count number of times id shows up in 24 hours (based on timestamp) (https://gfy.com/showthread.php?t=1069738)

mkx 05-29-2012 05:30 PM

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:

$result mysql_query("select count(*) from table where 'time' < now() - 3600");
$row mysql_fetch_row($result);
$count $row[0];

if (
$count 25) { //checks total emails sent within 24 hours
 
die(''); 


livexxx 05-29-2012 06:12 PM

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

sarettah 05-29-2012 08:44 PM

select whatever from table where time>=date_sub( now() ,INTERVAL 1 DAY)

should give you your activity in the last 24 hours



.

raymor 05-29-2012 10:00 PM

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