Hello,
We tried many spammer prevention codes into contact.html . But none of them worked. Still getting spam messages/links.
Can you suggest me a proper contact form code to prevent from spammers?
Here is our contact html:
What we do wrong on the above?
We tried many spammer prevention codes into contact.html . But none of them worked. Still getting spam messages/links.
Can you suggest me a proper contact form code to prevent from spammers?
Here is our contact html:
Code:
<Script type="text/javascript">
function CheckForm(f)
{
var err=new Array();
if(f.name.value=='')err.push("<TMPL_VAR lang_name_required>");
if( !f.email.value.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/) )err.push("<TMPL_VAR lang_invalid_email>");
if(f.message.value.length<5)err.push("<TMPL_VAR lang_message_too_short>");
if(err.length>0){alert(err.join('\n'));return false;}
if(preg_match('/http|www/i',$comments)) {
$error_message .= "We do not allow a url in the comment.<br />";
}
f.btn.disabled=true;
return true;
}
</Script>
<div class="rrd col-5">
<Form method="post" action="<TMPL_VAR site_url>/" onSubmit="return CheckForm(this);">
<input type="hidden" name="op" value="contact">
<input type="hidden" name="token" value="<TMPL_VAR token>">
<input type="hidden" name="rand" value="<TMPL_VAR rand>">
<!-- within your existing form add this field -->
<input type="text" id="website" name="website"/>
<input type="checkbox" name="contact_me_by_fax_only" value="1" style="display:none !important" tabindex="-1" autocomplete="off">
<Table width="90%" style="margin-bottom:0px;">
<tr>
<td>
<h2><TMPL_VAR lang_contact_us></h2>
E-mail Support/Contact: contact[at]mysite[dot]com
</br>
Please use ***.
</td>
</tr>
</Table>
<div class="cont_text">
****. Please take a minute reading both our <a href="faq.html">FAQ</a> and our <a href="tos.html"><TMPL_VAR lang_terms_of_service></a> before sending any messages regarding our services.
</div>
<Table width="90%">
<tr>
<td><TMPL_VAR lang_name>:<br /><input type="text" name="name" value="<TMPL_VAR name>" maxlength=32></td>
</tr>
<tr>
<td><TMPL_VAR lang_email>:<br /><input type="text" name="email" value="<TMPL_VAR email>" size=24 maxlength=32></td>
</tr>
<tr>
<td class="editor"><textarea id="message" name="message" rows=7><TMPL_VAR message></textarea></td>
</tr>
<TMPL_IF ihtml>
<tr>
<td align=center><TMPL_VAR ihtml></td>
</tr>
</TMPL_IF>
<tr>
<td align=center><font class="err"><TMPL_VAR msg></font><label for="turingtest"> <strong>Anti-Spam Question:</strong> Which is the wrong name of this host?: site or site2? *</label>
<br>
<input type="text" required="required" pattern="[ ]*(site)[ ]*" title="Pick the *****"/>
<br><input name="send" type="submit" name="btn" value="<TMPL_VAR lang_send_message>"></td>
</tr>
</table>
</div></Form>
<br><br><br><br>
<TMPL_IF my_login>
<link rel="stylesheet" type="text/css" href="<TMPL_VAR site_url>/css/dashboard-menu.css"/>
<style type="text/css">
@media (min-width: 1025px){
.holderPanel{background:#444;}
}
</style>
</TMPL_IF>
<style type="text/css">
.rrd input[type="text"], .rrd input[type="password"]{width:100%}
.SidemenuPanel ul.otherMenus li.activecnt{background:#363636; border-left:2px solid #131313; cursor:pointer}
.SidemenuPanel ul.otherMenus li.activecnt i{color:#fff;}
.SidemenuPanel{height:100%;}
@media (min-width: 980px) and (max-width: 1024px){
.rrd{width:70%;}
}
/*in your css hide the field so real users cant fill it in*/
form #website{ display:none; }
</style>
<TMPL_INCLUDE nic_edit.html>
What we do wrong on the above?