SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to improve this Contact Form?

    This contact form works fairly well, but I do get spam.

    Can you add something to this existing form that will make it a little better at not letting spam thru?

    HTML Code:
    <form action="../page.php?page=1" method="post" name="contact_us" onSubmit="return capCheck(this);">
    <table cellpadding="5" width="100%">
    <tr>
    <td width="10" class="required_field">*</td>
    <td width="80">Name</td>
    <td><input type="text" name="name" maxlength="50" style="width:400px; border: 1px solid #696969;" /><br /><br /></td>
    </tr>
    <tr>
    <td class="required_field">*</td>
    <td>Email Address</td>
    <td><input type="text" name="email" maxlength="40" style="width:400px; border: 1px solid #696969;" /><br /><br /></td>
    </tr>
    <tr>
    <td></td>
    <td>Subject:</td>
    <td><input type="text" name="subject" maxlength="40" style="width:400px; border: 1px solid #696969;"/><br /><br /></td>
    </tr>
    <tr>
    <td class="required_field">*</td>
    <td>Enter Image Code:</td>
    <td><input type="text" value="" name="captext" style="width: 100px" maxlength="6" /></td>
    </tr>
    <tr>
    <td></td>
    <td><a onclick="refresh_security_image(); return false;" style="cursor:pointer;"><u>Refresh Image</u></a></td>
    <td><img src="../includes/captcha.php" border="0" id="verificiation_image" /></a></td>
    </tr>
    </table>
    <br/>
    <p>
    <input type="hidden" name="submited" value="1" />
    <input type="submit" name="submit" value="Submit" style="margin:7px 10px 0px 0px; padding:10px 0px 10px 0px; font-size:15px; font-style:Century-Gothic;" />
    </p>
    </form>
    </td>
    </tr>
    </table>
    </div>
    <script type="text/javascript">
    <!--
    function refresh_security_image() {
    
    var new_url = new String("../includes/captcha.php?width=132&amp;height=36&charcators=");
    new_url = new_url.substr(0, new_url.indexOf("width=") + 37);
    // we need a random new url so this refreshes
    var chr_str = "123456789";
    for(var i=0; i < 6; i++)
    new_url = new_url + chr_str.substr(Math.floor(Math.random() * 2), 1);
    document.getElementById("verificiation_image").src = new_url;
    }
    -->
    </script>
    
    <!-- captch start -->
    <script type="text/javascript" id="clientEventHandlersJS" language="javascript">
    </script>
    <!-- captch end -->

    Thanks

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2006
    Location
    Nantwich, Cheshire
    Posts
    408
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Is that link to produce the captcha image correct? I'm thinking of the bit that says "charcators" where I'd have expected it to say "characters" or "charactors", and "verificiation_image". Might be nothing, of course whoever authored that function can use whatever parameter names they like, and I guess that bit wouldn't work at all if they were really incorrect.

    Other than that, though, you have to balance out making it impossible for spammers but still usable for normal people. I have no contact details on my web site, just a form with a few boxes and a note that says "if you're offering to boost by web position, number of followers or size of anything, don't waste your time" and I still get people who spend time filling out the form and sending this junk in.

    Also as the code isn't PHP, you might get a better response in a more appropriate section of the forum.
    http://www.firenza.net - my homage to a car from the 1970s

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,165
    Mentioned
    453 Post(s)
    Tagged
    8 Thread(s)
    Presumably there's a PHP script that sends the form, and that's where the spam filtering should be. JS spam filtering isn't worth much, as it can be turned off.


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
  •