D
D
Dmitry Mazikin2019-05-14 19:17:25
CAPTCHA
Dmitry Mazikin, 2019-05-14 19:17:25

How to fix captcha?

Good afternoon . I really need help, I broke my whole head. In general, there is a site on Bitrix, there is a section of vacancies, the client asked to put exactly the standard captcha on the resume submission form, without using a modular solution. Such are the things. In short, here is the code that I put in the template of this page

<?include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/captcha.php");
                            $cpt = new CCaptcha();
                            $captchaPass = COption::GetOptionString("main", "captcha_password", "");

                            if(strlen($captchaPass) <= 0)
                            {
                                $captchaPass = randString(10);
                                COption::SetOptionString("main", "captcha_password", $captchaPass);
                            }
                            $cpt->SetCodeCrypt($captchaPass);
                            ?>

                            <form id="writeUs" method="post" class="zayavkaform">
                                <div class="zayavwrap">
                                    <p>Введите код с картинки<span>*</span></p>
                                    <input class="captcha _sid" name="captcha_code" value="<?=htmlspecialchars($cpt->GetCodeCrypt());?>" type="hidden">
                                    <table>
                                        <tr>
                                            <td><input class="inptext" required="" id="captcha_word" name="captcha_word" type="text"></td>
                                            <td><img class="captchaImg" src="/bitrix/tools/captcha.php?captcha_code=<?=htmlspecialchars($cpt->GetCodeCrypt());?>"></td>
                                        </tr>
                                    </table>
                                    <div class="error-text"></div>
                                </div>
                            </form>

Everything works, the captcha appears, but whatever value is written from the picture, it always returns false. That is, no matter what characters are entered, correct or not, when checking, it always gives incorrectly entered data.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question