Advertisement
rdsedmundo

Captcha

Aug 16th, 2011
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function generation(m,n){cpt=n-m;zx=Math.random()*cpt;zxc=Math.floor(zx);return parseInt(m)+zxc}
  2. function generator(){
  3. var code=['1','q','2','e','E','3','4','r','5','t','6','y','7','8','9','0','p','a','s','d','f','g','h','k','l','ç','z','x','c','v','b','n','m'];
  4. ass=code[generation(1,16)];
  5. bss=code[generation(1,33)];
  6. css=code[generation(1,16)];
  7. dss=code[generation(1,33)];
  8. ess=code[generation(1,16)];
  9. fss=code[generation(0,33)];
  10. gss=code[generation(0,16)];
  11. hss=code[generation(0,33)];
  12. return ass+bss+css+dss+ess+fss+gss+hss;};function captcha(){
  13. a = generator();
  14. b = prompt('Digite o código captcha: '+a+'','');if(b==a){alert('Código captcha correto');return false}
  15. else{
  16. alert('Código captcha incorreto');if(!confirm('Quer tentar novamente?')){return false;};c = generator();d=prompt('Digite o código captcha: '+c+'','');function wrong(){captcha();};
  17. if(d==c){alert('Código captcha correto');return false;}
  18. else{alert('Código captcha incorreto');if(!confirm('Quer tentar novamente?')){return false;};wrong();};};};captcha();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement