R
R
ross20202020-11-19 12:12:19
reCAPTCHA
ross2020, 2020-11-19 12:12:19

How to make captcha/recaptcha in OpenCart 1.5.x registration form?

Good afternoon, please tell me how to install recaptcha on the registration page. Opencart version 1.5.5.1. Very tired of bots that hit the registration. I am very grateful for any help.
Page code

<?php echo $header; ?>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<!--<?php echo $column_left; ?><?php echo $column_right; ?>//-->
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <h1><?php echo $heading_title; ?></h1>
  <div id="create-account">
    <p><?php echo $text_account_already; ?></p>
    <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
      <h2><?php echo $text_your_details; ?></h2>
      <div class="content">
        <table class="form">
          <tr>
            <td><span class="required">*</span> <?php echo $entry_firstname; ?></td>
            <td>
              <input type="text" name="firstname" value="<?php echo $firstname; ?>" />
              <?php if ($error_firstname) { ?>
              <span class="error"><?php echo $error_firstname; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><?php echo $entry_lastname; ?></td>
            <td>
              <input type="text" name="lastname" value="<?php echo $lastname; ?>" />
              <?php if ($error_lastname) { ?>
              <span class="error"><?php echo $error_lastname; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><span class="required">*</span> <?php echo $entry_email; ?></td>
            <td>
              <input type="text" name="email" value="<?php echo $email; ?>" />
              <?php if ($error_email) { ?>
              <span class="error"><?php echo $error_email; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
            <td>
              <input type="text" name="telephone" value="<?php echo $telephone; ?>" />
              <?php if ($error_telephone) { ?>
              <span class="error"><?php echo $error_telephone; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><?php echo $entry_company; ?></td>
            <td><input type="text" name="company" value="<?php echo $company; ?>" /></td>
          </tr>
        </table>
      </div>
      <h2><?php echo $text_your_address; ?></h2>
      <div class="content">
        <table class="form">
          <tr>
            <td><?php echo $entry_address_1; ?></td>
            <td>
              <input type="text" name="address_1" value="<?php echo $address_1; ?>" />
              <?php if ($error_address_1) { ?>
              <span class="error"><?php echo $error_address_1; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><?php echo $entry_city; ?></td>
            <td>
              <input type="text" name="city" value="<?php echo $city; ?>" />
              <?php if ($error_city) { ?>
              <span class="error"><?php echo $error_city; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><?php echo $entry_postcode; ?></td>
            <td>
              <input type="text" name="postcode" value="<?php echo $postcode; ?>" />
              <?php if ($error_postcode) { ?>
              <span class="error"><?php echo $error_postcode; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><?php echo $entry_zone; ?></td>
            <td>
              <select name="zone_id">
                <option value="0"><?php echo $text_select; ?></option>
                <?php foreach ($zones as $zone) { ?>
                <?php if ($zone['zone_id'] == $zone_id) { ?>
                <option value="<?php echo $zone['zone_id']; ?>" selected="selected"><?php echo $zone['name']; ?></option>
                <?php } else { ?>
                <option value="<?php echo $zone['zone_id']; ?>"><?php echo $zone['name']; ?></option>
                <?php }
                } ?>
              </select>
            </td>
          </tr>
          <tr>
            <td><?php echo $entry_country; ?></td>
            <td>
              <select name="country_id">
                <option value=""><?php echo $text_select; ?></option>
                <?php foreach ($countries as $country) { ?>
                <?php if ($country['country_id'] == $country_id) { ?>
                <option value="<?php echo $country['country_id']; ?>" data-iso2="<?php echo $country['iso_code_2']; ?>" selected="selected"><?php echo $country['name']; ?></option>
                <?php } else { ?>
                <option value="<?php echo $country['country_id']; ?>" data-iso2="<?php echo $country['iso_code_2']; ?>"><?php echo $country['name']; ?></option>
                <?php } ?>
                <?php } ?>
              </select>
            </td>
          </tr>
        </table>
      </div>
      <h2><?php echo $text_your_password; ?></h2>
      <div class="content">
        <table class="form">
          <tr>
            <td><span class="required">*</span> <?php echo $entry_password; ?></td>
            <td>
              <input type="password" name="password" value="<?php echo $password; ?>" />
              <?php if ($error_password) { ?>
              <span class="error"><?php echo $error_password; ?></span>
              <?php } ?>
            </td>
          </tr>
          <tr>
            <td><span class="required">*</span> <?php echo $entry_confirm; ?></td>
            <td>
              <input type="password" name="confirm" value="<?php echo $confirm; ?>" />
              <?php if ($error_confirm) { ?>
              <span class="error"><?php echo $error_confirm; ?></span>
              <?php } ?>
            </td>
          </tr>
        </table>
      </div>
      <h2><?php echo $text_newsletter; ?></h2>
      <div class="content">
        <table class="form">
          <tr>
            <td><?php echo $entry_newsletter; ?></td>
            <td>
              <input type="radio" name="newsletter" value="1" checked="checked" />
              <?php echo $text_yes; ?>
              <input type="radio" name="newsletter" value="0" />
              <?php echo $text_no; ?>
            </td>
          </tr>
        </table>
      </div>
      <?php if ($text_agree) { ?>
      <div class="buttons">
        <div class="left">
          <input type="checkbox" name="agree" value="1" /> <?php echo $text_agree; ?>
          <?php if ($error_agree) { ?>
          <span class="error"><?php echo $error_agree; ?></span><br />
          <?php } else { ?>
          <br /><br />
          <?php } ?>
          <input type="submit" value="<?php echo $button_continue; ?>" class="button" />
        </div>
      </div>
      <?php } else { ?>
      <div class="buttons">
        <div class="left">
          <input type="submit" value="<?php echo $button_continue; ?>" class="button" />
        </div>
      </div>
      <?php } ?>
    </form>
  </div>
<?php echo $content_bottom; ?>
</div>
<script type="text/javascript"><!--
var current_zone_id = '<?php echo $zone_id; ?>';
$('select[name=\'country_id\']').bind('change', function() {
  $.ajax({
    url: 'index.php?route=account/address/country&country_id=' + this.value,
    dataType: 'json',
    beforeSend: function() {
      $('select[name=\'country_id\']').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
    },		
    complete: function() {
      $('.wait').remove();
    },			
    success: function(json) {
      html = '<option value=""><?php echo $text_select; ?></option>';
      
      if (json != '' && json['zone'] != '') {
        for (i = 0; i < json['zone'].length; i++) {
          html += '<option value="' + json['zone'][i]['zone_id'] + '"';
          
          if (json['zone'][i]['zone_id'] == current_zone_id) {
            html += ' selected="selected"';
          }
  
          html += '>' + json['zone'][i]['name'] + '</option>';
        }
      } else {
        html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
      }
      
      $('select[name=\'zone_id\']').html(html);
    },
    error: function(xhr, ajaxOptions, thrownError) {
      alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
    }
  });
});

$(document).ready(function() {
  $('.colorbox').colorbox({
    width: 640,
    height: 480
  });
});
//$('select[name=\'country_id\']').trigger('change');
//--></script> 
<?php echo $footer; ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
web-mechanic, 2020-12-01
@amfetamine

https://developers.google.com/recaptcha/intro - here is the documentation,
and there is just a search in Google, for a start it would be nice to use it, because it's all been decided and explained

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question