The essence of the problem lies in the button. How should she work? The button must not be active until the user completes the captcha. After the captcha has been executed, the button must be active and after clicking the user it is credited +1 point to the balance. But the button does not work at all. Nothing happens. Why? Not clear. I ask for help! Button code:

<form action="pay" method="post"> <div id="money_captcha_wrapper" class="money_captcha_wrapper"> <script type="text/javascript" src="https://moneycaptcha.ru/captcha.php?siteid=33075&charset=utf-8&button=moneycaptchasubmit"></script> </div> <input name="moneycaptcha_code" id="moneycaptcha_code" type="hidden" value=""> </form> <br><br> <input type="submit" value="Отправить данные" name="moneycaptchabottom" id="moneycaptchasubmit" title="Вам необходимо правильно ответить на капчу"><img scr="/template/images/bottom.png"></> 

Code to be executed after pressing the button:

  <?php if(!isset($Functions)){ die("Error! 404"); } $user = $Functions->getUser(); $payment = '1'; if(isset($_POST['moneycaptchabottom']) { $result = $Functions->giveMoney($user,$payment); } if (isset($_POST['moneycaptcha_code'])) { $handle = curl_init(); curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($handle, CURLOPT_URL, "https://moneycaptcha.ru/valid.php?code=$_POST[moneycaptcha_code]"); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); $status = curl_exec($handle); if ( $status === false ) echo "<br>" . curl_error($handle); curl_close($handle); $xml = simplexml_load_string($status); if ($xml->code == "1"){ //Здесь обработчик клиента} }//Конец обработчик клиента } 
  • Try to shorten the code, from not wanting to read so much. In general, this is done as follows 1. capcha is generated, and the data is stored in the session - Vanya Avchyan
  • 2. When a user types captcha, you can send AJAX and check for correctness 3. if true, then php code returns json for example success => true 4. javascript code gets succss: true and activates the button But I would do differently, I would decide the number characters in captcha, for example, 5, and each time when typing in the input, the captcha would count if it is 5, then it would activate the button, and validate it on the server side, along with the rest of the data - Vanya Avchyan
  • Krc This captcha is not ordinary. There as a task you carry out. Go to the site that is listed in the captcha. Make a screenshot. Answer the question. And after 2 questions, it already shows that everything is fine and the button is activated. But for some reason she does not add anything to the user. I click and zero action. Generally not what. Just hide it and I can make it active after the execution of the captcha, only the button itself does not work. And what the problem is not clear. - PolarWatch
  • Krc The button then works, but crashes with an error: The ******* page does not work The ********* website cannot process this request yet. User score is not added at all. - PolarWatch

1 answer 1

The button is not inside the form tag. If it is necessary that the button be outside the form, then you need to specify the form id, and put it in the parameter in the form button.

  • so it is already outside the form, carefully look at form br br input type = "submite" - user33274
  • that's why it doesn't work - Zhandos Man
  • The button does not work because outside? - PolarWatch
  • @PolarWatch don't forget to indicate that my answer helped you, if it helped of course - Zhandos Man