N
N
Nikita Ivanov2015-11-29 19:37:19
PHP
Nikita Ivanov, 2015-11-29 19:37:19

How to check captcha?

There was a need to insert a captcha on the page, it appears, but I can’t figure out how to check it.

<form action="" id="form">
<div id="captcha-wrap">
    <div class="captcha-box">
      <img src="re/get_captcha.php" alt="" id="captcha" />
    </div>
    <div class="text-box">
      <label>Type the two words:</label>
      <input name="captcha-code" type="text" id="captcha-code" >
    </div>
    <div class="captcha-action">
      <img src="refresh.jpg"  alt="" id="captcha-refresh" />
    </div>
  </div>

    <input name="vin_send" id="www" value="Подать запрос" type="submit" class="auto_user_button" >
</form>

<script>
//Отправка формы
  $(document).ready(function(){
    $('#form').submit(function(){
      $.ajax({
        type: 'POST',
        url: 'mail.php',
        data: $(this).serialize()
      }).done(function(){
        $('#form').fadeOut(600);
        $('.done').css('display','block');
        
      });
      return false;
    });
  });
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2015-12-04
@bingo347

here in this script you generate a captcha: re/get_captcha.php
it should also remember the generated text, for example, in the session
, when receiving the form, we compare the string sent by the client with the one in the session

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question