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 Link to comment https://forums.phpfreaks.com/topic/138354-mail-function-help-needed/ 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 Link to comment https://forums.phpfreaks.com/topic/138354-mail-function-help-needed/#findComment-723440 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 Link to comment https://forums.phpfreaks.com/topic/138354-mail-function-help-needed/#findComment-723443 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 Link to comment https://forums.phpfreaks.com/topic/138354-mail-function-help-needed/#findComment-723450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.