Results 1 to 10 of 10

Thread: Safe or no?

  1. #1
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Safe or no?

    I was trying to find a *SIMPLE* way of preventing spam-bots from spamming through my form, I came up with this:

    Code:
    <?php
    if(($_POST['answer'])=="blue") {
    
    $to = "theemail";
    $subject = $_POST['subject'];
    $name_field = $_POST['name'];
    $email_field = $_POST['email'];
    $message = $_POST['message'];
     
    $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
     
    echo "Data has been submitted to $to!";
    mail($to, $subject, $body);
    
    } else {
    
    echo "Error, please try again!";
    
    }
    ?>
    This was adapted from some simple code I found on About.com or something, I've been using it forever... Anyways is it safe or no? I tested and it works fine.

  2. #2
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If the code that the user has to input the "Answer" looks like what i think it looks like a bot could easily pass the security measure, although its not all that bad of a security pass through, its not that great. Its safe to an extent.

  3. #3
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    What do you mean? I was think a simple thing like "What is the name of this site?" or something, then if its correct then it sends, if no it just returns error.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This could certainly help. But it's not foolproof. Just program the bot to answer that, and it stops working.

    The answer is using a CAPTCHA, which seems to be the method that works the best.

    Gimmicky ways can work some, but they're only as strong as it would be to program the bot to understand it. So, if it's a really popular site, it'll be broken quickly. If not, and it's just casual spammers, that should be fine.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Not to worry, its so un-popular I worry if my host will kick me o.o; but I have been getting spammed. Ok then, thanks.

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Spambots find a form and start spamming it. In most cases, anything that makes it hard to submit will stop them-- but if the programmer of the bot specifically targets your site, it's easy to get around.
    So, in your case, that should work easily enough.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Good to know. Spam-bots are so inconvenient.

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Indeed. It's especially bizarre when you have some sort of admin-only contact form that just goes somewhere into the depths of a database and you find many ads for viagra and such. Like that's going to generate sales.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    You could try reCAPTCHA if you want to.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  10. #10
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Maybe someones going to buy their Viagra.

    edit: and thanks tech_support I'll check it out.

Bookmarks

Posting Permissions

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