Tweet, Share & Like [ EnAcCiOn ]

 

FeedBurner FeedCount Y Facebook | EnAcCiOn

Send Voicemail | EnAcCiOn

Contact me using vCita | EnAcCiOn

Contact me using vCita | EnAcCiOn

Meeting Scheduler Powered by vCita

martes, 14 de julio de 2015

Re: Recaptcha V2 hopefully made simple. Both HTML and PHP code included here

I think I'm going to have to disagree with you about the code in my original post. Here's what I did to test it so you can try and recreate it. When I got to the recaptcha, I got the series of pictures but I picked the wrong photos intentionally, so it gave me a new set. While those new pics were up on the screen, I clicked the submit button and I got the error message to check the recaptcha. If I go back to the process routine and have it dump $captcha it in fact is null. So then I commented out the the code which checks for  !$captcha and let it fall through and execute the $response = file_get_contents("https ... andjust had it echo $response and here was what I got when I repeated the same test of not answering the pictures correctly:{ "success": false, "error-codes": [ "missing-input-response" ] }So I would say the code in fact works just fine. The HOWEVER I would put in there is if in fact you wanted to find out what the error code was (in my case I don't care), you could then use EXPLODE or some other code to go extract the error code.Again I don't take credit for this code as it was not in fact mine but I love the simplicity of it. Thanks for looking and making me look at the code closer. DonnaOn Monday, July 13, 2015 at 6:45:30 PM UTC-7, Martin Brilliant wrote: I looked on the web and I think I have a working test. Since $response is a JSON object, it should be decoded to an associative array, and then the appropriate element of the array should be tested. So we need, first,      $response = json_decode($response, true);and then the test should be      if($response['success'])With those changes, I got "You have been identified as a robot" when the secret key was wrong, and "Thanks for getting it right" after I restored the correct secret key.I'm waiting for somebody else to verify that this code is OK before I use it. Meanwhile I'm still using V1.BTW I got a new key pair for V2, different from the pair I was using for V1. I have a vague recollection that I tried the same code before, but using the same key pair as for V1, and it always tested false. If so, you need a new key pair for V2. But I could be mistaken.On Monday, July 13, 2015 at 9:14:24 PM UTC-4, Martin Brilliant wrote: How carefully did you test this code? I added some debugging statements, and then tested it by altering the secret key. The debugging showed false, but the test always succeeded. So, meanwhile, I'm still using V1.Here is my code (after getting the POST parameters and the $response to the file_get_contents statement):

No hay comentarios:

EnAcCiOn

Contador Web | EnAcCiOn

EnAcCiOn

EnAcCiOn

EnAcCiOn

Blog Archive | EnAcCiOn