prevent mass email

Discussion in 'Coding Help' started by louie, Jul 7, 2006.

  1. louie

    louie New Member

    Lately there are a lot of email coming trough from the websites using remote access to you form.
    It happened to me as well. Got about 100 email in 20 min, so what i did was to create a session and if bigger then 2 (no more then 2 email per session) i redirect them to the home page.
    If anybody find it usefull you are more then welcome to use it.
    Is in php but can be easily converted to any language.

    if you have a global include file like top.php add this to it:

    Code:
     
    //block mass email senders
    // change this to you variable :: (@$_POST["sendemail"] == '1' ::
    if (@$_POST["sendemail"] == '1') {
     $_SESSION['you_send_email'] = @$_SESSION['you_send_email']+1;  
    }
    //end of block mass email senders
    
    then on the page with the form add this before the email execute code:

    Code:
     
    //block mass email senders
    if (@$_SESSION['you_send_email'] > 2){
     $_SESSION['you_send_email'] == 2;
      header("Location: [URL="http://www.yourdomainname.tld/index.php"]http://www.yourdomainname.tld/index.php[/URL]");
     exit(); 
    }
    //end of block mass email senders
    
    hope this help anybody
     
  2. mneylon

    mneylon Administrator Staff Member

    Does it work?
     
  3. louie

    louie New Member

    It worked for me yestarday. I was getting like 10-20 email every 5min, so i had to do something quick.

    after i uploaded the code i got another 2 emails and it stoped.
     

Share This Page