pmiller624 Posted December 25, 2008 Share Posted December 25, 2008 how would i restrict the number for out going mail to a certain number an hour per ip also how do i call it through the url and but spaces in the message Quote Link to comment Share on other sites More sharing options...
chronister Posted December 25, 2008 Share Posted December 25, 2008 Use a database and keep track of what emails were sent and what IP sent them. If the number sent equals your max, then deny. In the database have a field for IP, a field for sent time (as a date/time field). If you keep it as a date/time field you can run a query such as SELECT count(*) as numSent FROM mailSent WHERE IP='$ipAddress' && sentTime BETWEEN 'X' and 'X'; Clarify this part also how do i call it through the url and but spaces in the message Nate Quote Link to comment Share on other sites More sharing options...
pmiller624 Posted December 25, 2008 Author Share Posted December 25, 2008 sorry i ment to say how do i put spaces in a url but i found out how "%20" SELECT count(*) as numSent FROM mailSent WHERE IP='$ipAddress' && sentTime BETWEEN 'X' and 'X'; what it the X and Y Quote Link to comment Share on other sites More sharing options...
chronister Posted December 25, 2008 Share Posted December 25, 2008 In sql when you have a proper date/time column, you can select items between date x and date y, or time x and time y....e.g. <?php $now = date('Y-m-d G:i:s', time()); $oneHourAgo = date('Y-m-d G:i:s',(time()-3600)); $usersIP = $_SERVER['REMOTE_ADDR']; $query = "SELECT count(*) as numSent FROM mailSent WHERE IP = '$usersIP' && timeSent BETWEEN '$oneHourAgo' AND '$now' "; echo $query; ?> The query then becomes something like this.. SELECT count(*) as numSent FROM mailsent WHERE IP = '12.199.255.1' && timeSent BETWEEN '2008-12-24 20:25:52' AND '2008-12-24 21:25:52' This will return the number of emails sent in the last hour. You can adjust this to whatever you wish, but it is a basic example. Merry Christmas!! Nate Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.