View Single Post
Old 05-17-2011, 07:15 PM  
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Need a quick php line

Hostgator shutdown my script for www.whatstheirip.com since some nithead abused it and it was sending out more than 500 emails an hour which is their limit. I am trying to put an anti-abuse script into place. I made a table called antiabuse with an id, sentmail, and timestamp field. Before sending an email, it inserts a 1 into antiabuse field. If lets say 300 1's are in the antiabuse table within the last hour, I want it to not send any more emails out.

Basically here is what i have =

//anti abuse - makes sure no more than 250 emails are sent out in one hour

mysql_query("INSERT INTO antiabuse (emailsent)
VALUES ('1')");

Next I need an if statement which is what I am having problems with. Here is it in laymans terms:

Count the number of 1's in antiabuse table emailssent field within the last hour, if the number is greater than 250 echo "Sorry please wait" else (i'll insert the the email script here to proceed with emailing)

Hope someone can help, this is a free script I made a year ago on my free time and a lot of people seem to be relying on it :/
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote