***annuncioVideo***
A little soft easy and user-friendy captcha, instead of sometimes hard reading captcha we can view in some sites.
Captcha number is created by a javascript client-side script, and inserted in a hidden input field.
You can run a double check:
– client-side: check if random js number is the same value of hidden field
– server-side: checking fields url.captcha and url.captchaHidden
Test page : captcha.cfm (a standard HTML page, without server-side script).
Let check it 🙂
<script language="javascript">
function myLayer (x){
//object finding
if(document.layers){ // browser="NN4";
lay=document.layers[x];
}
if(document.all){ // browser="IE";
lay=eval("document.all." + x);
}
if(!document.all && document.getElementById){ // browser="NN6+ or IE5+ if you’re willing to dump the !document.all stuff";
lay=document.getElementById(x);
}
return lay;
}
function fnCaptcha(){
var numero=Math.random()*7*666;
var numero=Math.floor(numero);
myLayer("captchaNumber").innerHTML = numero;
document.frmCaptcha.captchaHidden.value = numero;
}
function fnCaptchaCheck(f){
if ((f.captcha.value == "") || (f.captcha.value == f.captchaHidden.value)){
alert("Different numbers. Check KO ");
}else{
alert("Same numbers. Check OK. ");
}
return false();
}
window.onload=function(){fnCaptcha();}
</script>
<h3>Prova Captcha</h3>
Insert number you can see between brackets (<span id="captchaNumber"></span>)<br />
<form id="frmCaptcha" name="frmCaptcha" method="post" action="" onsubmit="return fnCaptchaCheck(this)">
<input name="captcha" type="text" id="captcha" />
<input name="captchaHidden" type="hidden" id="captchaHidden" />
<input type="button" name="Submit" value="Pulsante" />
</form>
<br />
To improve security level, you can translate form from get post, to form post.
(f.captcha.value == f.captchaHidden.value)
should be
(f.captcha.value !== f.captchaHidden.value)
or am I missing something?
@mauricio: please go to these new link:
– http://tinyurl.com/2bwcwg
– http://tinyurl.com/yphfkr
And
http://hiddy.etechs.it