Jump to content

Help improve this Contact Form


Chrisj

Recommended Posts

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?

<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&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

Link to comment
https://forums.phpfreaks.com/topic/288818-help-improve-this-contact-form/
Share on other sites

This is no code-for-free service.

 

If you're talking about automated spam, check out reCAPTCHA. Home-made CAPTCHAs may be fun, but they're no match for any halfway intelligent spam bot.

 

Trap fields also help: You make an invisible field, and if the client fills it out, you can be pretty sure it's a bot.

 

Last but not least, there are blacklists of known spammers. See if they cover “your” spammers as well.

Archived

This topic is now archived and is closed to further replies.

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