Jump to content

mail() function help needed


pmiller624

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.