Send Mail w/PHP with time limit
Results 1 to 3 of 3

Thread: Send Mail w/PHP with time limit

  1. #1
    Banned
    Join Date
    Apr 2003
    Posts
    51

    Send Mail w/PHP with time limit

    i'm trying to do a form thing were people can send mail to me by filling out a forum. I also dont want people to spam me, so i want to make sure a visitor can only send mail to me every hour. How would i go about doing this? I have the following PHP coding so far..

    PHP Code:
    <?php

    if (isset($_POST['name']) && isset($_POST['email']))
    {

        
    $name=$_POST['name'];
        
    $email=$_POST['email'];
        
    $caption=$_POST['caption'];

        
    str_replace('\"','"',str_replace("'","'",$name));
        
    str_replace('\"','"',str_replace("'","'",$caption));

        
    $to="nitro@tsr-corp.com";
        
    $headers "From: $email\n";

        
    $message="Name: $name\n\nEmail: $email\n\nCaption: $caption";

        if (!
    $name || !$email || !$caption)
        {
            echo 
    'You have left some areas blank.  Please fill out the form completely';
        }
        if(
    mail($to,"Caption",$message,"$headers"))
        {
            echo 
    "Name: $name
    Email: 
    $email
    Caption: 
    $captionz

     Thank you, 
    $name, for your comment. ";
        }
        else 
        {
            echo 
    "There was a problem sending the mail. Please contact The Webmaster if this problem persists.";
        }

    }

    else
    {
        echo 
    "To submit a Caption, please look under \"Create a Caption\" under the navigaiton";
    }
    ?>
    I just dont know how to do the ip time limit thing, can someone help?

  2. #2
    AO French Antique News Whore
    Join Date
    Aug 2001
    Posts
    2,126
    I'm not a expert in PHP but the only way I see is whenever someone send you a e-mail, the php script store the time in a txt/dat file or sql database. When the user return, you just do a quick check if your timer is done..
    -Simon \"SDK\"

  3. #3
    Banned
    Join Date
    Apr 2003
    Posts
    51
    yeah, that's what i was thinking, but i dont know how to do the timestamp thing as well as check it against the i.p. in the text file

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •