Forum: Captchator ajax and captcha Permission Denied

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F1f59eb198f39ba1d13146884f9fd799?d=identicon&s=25 Mark Babcock (markb)
on 2008-06-26 22:53
I keep getting a permission Denied and I'm not sure why.  Any able to
help with this?


<form name="myform">
<table>
    <tr>
           <td colspan="2"><img
src="http://captchator.com/captcha/image/123456"></td>...
           <td><input type="button" value="reload captcha" alt="unable
to read captcha?"/></td>
    </tr>
    <tr>
           <td colspan="3"><input type="text" name="captchaValue"/></td>
    </tr>

</table>
</form>
<script language="JavaScript">
     var url = 'http://captchator.com/captcha/check_answer/123456/';
     var captchaOK = 2;  // 2 - not yet checked, 1 - correct, 0 - failed
     function getHTTPObject() {
          if(navigator.appName == "Microsoft Internet Explorer") {
              req = new ActiveXObject("Microsoft.XMLHTTP");
          } else {
              req = new XMLHttpRequest();
          }

         return req;

     }

      var http = getHTTPObject(); // We create the HTTP Object

      function handleHttpResponse() {
           if (http.readyState == 4) {
                 captchaOK = http.responseText;
                if(captchaOK != 1) {
                     alert('The entered code was not correct. Please try
again');
                     return false;
                }
              alert("Captcha okie dokie");
           }

      }

      function validateCaptcha() {

           var captchaValue = document.myform.captchaValue.value;
           var urlValidation = url + captchaValue;
alert(" ? " + urlValidation);
           http.open("GET", urlValidation);
alert("xx");
           http.onreadystatechange = handleHttpResponse;
alert("YY");
http.send(null);
      }
</script>
10a0004d585e5f0fca9a6648f61e8470?d=identicon&s=25 Jim .. (jtoly)
on 2008-06-27 05:19
Mark Babcock wrote:
> I keep getting a permission Denied and I'm not sure why.  Any able to
> help with this?

I just copied your code, created a new Rails project and set this code
to be the index.html.erb file.

It "worked" fine for me, in so far as the captcha image loads, the
button to reload the image is there and functions, and the text field
accepts user input.

So while I don't see how your code was going to return a valid/not-valid
response code (like I say I just pasted it in and haven't scrutinized
it! :-), I don't get a Permission Denied problem.

Can you be more specific on when/where/how the error comes up?
2bcab76ba795e4cac4ae780c01df1e53?d=identicon&s=25 Luis Pulido (pulidoman)
on 2009-09-30 16:38
Jim Tobin wrote:
> Mark Babcock wrote:
>> I keep getting a permission Denied and I'm not sure why.  Any able to
>> help with this?
>
> I just copied your code, created a new Rails project and set this code
> to be the index.html.erb file.
>
> It "worked" fine for me, in so far as the captcha image loads, the
> button to reload the image is there and functions, and the text field
> accepts user input.
>
> So while I don't see how your code was going to return a valid/not-valid
> response code (like I say I just pasted it in and haven't scrutinized
> it! :-), I don't get a Permission Denied problem.
>
> Can you be more specific on when/where/how the error comes up?

I implemented the captchator service with jQuery and PHP, making it
capable to handle AJAX. You can use the source code.

You can check it at http://luispulido.com/cc/captchator-jquery/

Hope you find it useful.

-Luis
This topic is locked and can not be replied to.