Hướng dẫn bỏ mã captcha trên form liên hệ - nukeviet
- Thứ năm - 14/10/2021 04:35
- In ra
- Đóng cửa sổ này
Vì lý do nào đó bạn muốn bỏ đi phần mã chống spam trên form liên hệ. Bài viết này mình hướng dẫn thực hiện điều này.
Mở modules/contact/funcs/main.php
Tìm và xóa (hoặc comment)
if (!nv_capcha_txt(($global_config['captcha_type'] == 2 ? $nv_Request->get_title('g-recaptcha-response', 'post', '') : $nv_Request->get_title('fcode', 'post', '')))) { nv_jsonOutput(array( 'status' => 'error', 'input' => ($global_config['captcha_type'] == 2 ? '' : 'fcode'), 'mess' => ($global_config['captcha_type'] == 2 ? $lang_global['securitycodeincorrect1'] : $lang_global['securitycodeincorrect']))); }
Mở modules/contact/theme.phpTìm và xóa
if ($global_config['captcha_type'] == 2) { $xtpl->assign('RECAPTCHA_ELEMENT', 'recaptcha' . nv_genpass(8)); $xtpl->assign('N_CAPTCHA', $lang_global['securitycode1']); $xtpl->parse('main.recaptcha'); } else { $xtpl->assign('GFX_WIDTH', NV_GFX_WIDTH); $xtpl->assign('GFX_HEIGHT', NV_GFX_HEIGHT); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('CAPTCHA_REFRESH', $lang_global['captcharefresh']); $xtpl->assign('NV_GFX_NUM', NV_GFX_NUM); $xtpl->parse('main.captcha'); }
Mở themes/ten-theme/modules/contact/form.tplTìm và xóa
<!-- BEGIN: captcha --> <div class="form-group"> <div class="middle text-right clearfix"> <img width="{GFX_WIDTH}" height="{GFX_HEIGHT}" title="{LANG.captcha}" alt="{LANG.captcha}" src="/index.php?scaptcha=captcha&t={NV_CURRENTTIME}" class="captchaImg display-inline-block"> <em onclick="change_captcha('.fcode');" title="{GLANG.captcharefresh}" class="fa fa-pointer fa-refresh margin-left margin-right"></em> <input type="text" placeholder="{LANG.captcha}" maxlength="{NV_GFX_NUM}" value="" name="fcode" class="fcode required form-control display-inline-block" style="width:100px;" data-pattern="/^(.){{NV_GFX_NUM},{NV_GFX_NUM}}$/" onkeypress="nv_validErrorHidden(this);" data-mess="{LANG.error_captcha}"/> </div> </div> <!-- END: captcha --> <!-- BEGIN: recaptcha --> <div class="form-group"> <div class="middle text-center clearfix"> <div class="nv-recaptcha-default"><div id="{RECAPTCHA_ELEMENT}"></div></div> <script type="text/javascript"> nv_recaptcha_elements.push({ id: "{RECAPTCHA_ELEMENT}", btn: $('[type="submit"]', $('#{RECAPTCHA_ELEMENT}').parent().parent().parent().parent()) }) </script> </div> </div> <!-- END: recaptcha -->