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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.