Author: J.Yard2 (5 Nov 08 1:38pm)
On the assumption that most comment spammer bots do not execute JavaScript, the following example shows how to use JavaScript to set the form action and thus requiring the JavaScript to be executed to submit the form.
If the JavaScript is not executed then the "comment_spammer.php" code is executed by default when the form is submitted, which could be used to provide a honey pot, etc. If the JavaScript is executed then when the form is submitted the "real_user.php" code is executed to accept and process the form.
<form method="POST" action="/comment_spammer.php" onsubmit="return CheckForm(this);" name="Form_Name">
. . . Your form here . . .
</form>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
function CheckForm(theForm) {
. . . Your form check here . . .
theForm.action = "/real_user.php";
return true;
}
</SCRIPT>
Post Edited (5 Nov 08 2:23pm)
|