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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 05-29-2012, 05:30 PM   #1
mkx
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:
$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(''); 
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-29-2012, 06:12 PM   #2
livexxx
Confirmed User
 
livexxx's Avatar
 
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
__________________
http://www.webcamalerts.com for auto tweets for web cam operators
livexxx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-29-2012, 08:44 PM   #3
sarettah
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!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-29-2012, 10:00 PM   #4
raymor
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.
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.