Question : Prevent form from submitting if certain words or domains entered, spam control

HI, A spammer is submitting forms by the hundreds, I cannot stop the form from server side processing because the script is ionCubed (protected). Can Javascript or any other script be used to create a short list of blacklisted words that would prevent the form from being submitted? Here's the form
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<h2 style="text-align:center;">Send Email</h2>
<div style="text-align:center;font-weight:bold;">Items marked <span class="required">*</span> are required</div>
<form name="contactagent" action="http://site.com/trade/index.php?action=addon_contactform_agentsend&amp;popup=yes" method="post" onSubmit="return validate_form ( );">
<input type="hidden" name="id" value="6087" />
<table align="center">
	<tr>
		<td class="contact_fieldnames">Name <span class="required">*</span></td>
		<td class="contact_fieldnames"><input type="text" name="cf_name" size="20"/></td>
	</tr>
	<tr>
		<td class="contact_fieldnames">Email <span class="required">*</span></td>
		<td class="contact_fieldnames"><input type="text" name="cf_email" size="20" /></td>
	</tr>
    
    <tr>
		<td class="contact_fieldnames">Your Email (again) <span class="required">*</span></td>
		<td class="contact_fieldnames"><input type="text" name="email_again" size="20" /></td>
	</tr>
    
	<tr>
		<td class="contact_fieldnames">Subject</td>
		<td class="contact_fieldnames"><input size="50" type="text" name="subject" value="Private swap proposal for: Waterfront, private island, modern, tropical resort-like setting" /></td>
	</tr>
	<tr>
		<td class="contact_fieldnames">Message</td>
		<td class="contact_fieldnames"><textarea name="Message" cols="30" rows="6">
</textarea></td>
	</tr>
	<tr><td class="contact_fieldnames">Swap for MY GoSwap listing ID</td><td class="contact_fieldnames"><input type="text" name="Swap_for_MY_GoSwap_listing_ID" value="" onchange="if (!IsNumeric(contactagent.Swap_for_MY_GoSwap_listing_ID.value)) {
	alert('Please enter only numbers in the  Swap_for_MY_GoSwap_listing_ID  field'); contactagent.Swap_ID.focus();contactagent.Swap_for_MY_GoSwap_listing_ID.value=''; } " /></td></tr><tr><td class="contact_fieldnames">Phone</td><td class="contact_fieldnames"><input type="text" name="Phone" value=""  /></td></tr>
	
	<tr>
		<td>&nbsp;</td>
		<td><img src="http://site.com/trade/addons/contactform/include/captcha_image.php" /></td>
	</tr>
	<tr>
		<td><span class="contact_fieldnames">Verification code</span></td>
		<td><input id="security_code" name="security_code" type="text" /></td>
	</tr>
	
	
	<tr>
		<td colspan="2" style="text-align:center;"><input type="submit" value="Send Email" /></td>
	</tr>

</table>
</form>

Answer : Prevent form from submitting if certain words or domains entered, spam control

Thanks for the return (function() && another_function()) wisdom.. here is another validation script based on that.


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<h2 style="text-align:center;">Send Email</h2>
<div style="text-align:center;font-weight:bold;">Items marked <span class="required">*</span> are required</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
function validate_this_form(){
	var haystack = new Array("viagra","other","spam","stuff");                                         
	var valid = true
	$(".validate").each(function(){
		var compare_text = $(this).val();
		for(var i=0; i<haystack.length; i++){
			for(var j=0; j<(compare_text.length); j++){
				if(haystack[i]==compare_text.substring(j,(j+haystack[i].length)).toLowerCase()){
					valid = false;
				}
			}
		}
	});
	if(valid){
		return true;
	}else{
		alert("Whatever you want to tell the spammer!");
		return false;
	}
}
</script>
<form name="contactagent" id="submit_form" action="http://site.com/trade/index.php?action=addon_contactform_agentsend&amp;popup=yes" method="post" onSubmit="return(validate_this_form() && validate_form ());">
<input type="hidden" name="id" value="6087" />
<table align="center">
        <tr>
                <td class="contact_fieldnames">Name <span class="required">*</span></td>
                <td class="contact_fieldnames"><input type="text" name="cf_name" size="20" class="validate"/></td>
        </tr>
        <tr>
                <td class="contact_fieldnames">Email <span class="required">*</span></td>
                <td class="contact_fieldnames"><input type="text" name="cf_email" size="20"  class="validate"/></td>
        </tr>
    
    <tr>
                <td class="contact_fieldnames">Your Email (again) <span class="required">*</span></td>
                <td class="contact_fieldnames"><input type="text" name="email_again" size="20"  class="validate"/></td>
        </tr>
    
        <tr>
                <td class="contact_fieldnames">Subject</td>
                <td class="contact_fieldnames"><input size="50" type="text" name="subject" value="Private swap proposal for: Waterfront, private island, modern, tropical resort-like setting" class="validate"/></td>
        </tr>
        <tr>
                <td class="contact_fieldnames">Message</td>
                <td class="contact_fieldnames"><textarea name="Message" cols="30" rows="6"  class="validate">
</textarea></td>
        </tr>
        <tr><td class="contact_fieldnames">Swap for MY GoSwap listing ID</td><td class="contact_fieldnames"><input type="text" name="Swap_for_MY_GoSwap_listing_ID" value="" onchange="if (!IsNumeric(contactagent.Swap_for_MY_GoSwap_listing_ID.value)) {
        alert('Please enter only numbers in the  Swap_for_MY_GoSwap_listing_ID  field'); contactagent.Swap_ID.focus();contactagent.Swap_for_MY_GoSwap_listing_ID.value=''; } " class="validate" /></td></tr><tr><td class="contact_fieldnames">Phone</td><td class="contact_fieldnames"><input type="text" name="Phone" value="" class="validate"/></td></tr>
        
        <tr>
                <td>&nbsp;</td>
                <td><img src="http://site.com/trade/addons/contactform/include/captcha_image.php" /></td>
        </tr>
        <tr>
                <td><span class="contact_fieldnames">Verification code</span></td>
                <td><input id="security_code" name="security_code" type="text"   class="validate"/></td>
        </tr>
        
        
        <tr>
                <td colspan="2" style="text-align:center;"><input type="submit" value="Send Email" /></td>
        </tr>

</table>
</form>
Random Solutions  
 
programming4us programming4us