Opencart v2.3,联系我们表单通过,无需验证 google 验证码。当我们按下提交按钮时,它不会要求验证码
Opencart v2.3, Contact us form passes without authenticating google captcha. When we press the submit button it doesn't ask for captcha
这是客户端集成。这是我的网站 www.festivetaste.com
连最基本的要点都没有出现。
以下是 contact.tpl 文件中的代码。
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" class="form-horizontal">
<fieldset>
<legend><?php echo $text_contact; ?></legend>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-name"><?php echo $entry_name; ?></label>
<div class="col-sm-10">
<input type="text" name="name" value="<?php echo $name; ?>" id="input-name" class="form-control" />
<?php if ($error_name) { ?>
<div class="text-danger"><?php echo $error_name; ?></div>
<?php } ?>
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-email"><?php echo $entry_email; ?></label>
<div class="col-sm-10">
<input type="text" name="email" value="<?php echo $email; ?>" id="input-email" class="form-control" />
<?php if ($error_email) { ?>
<div class="text-danger"><?php echo $error_email; ?></div>
<?php } ?>
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-enquiry"><?php echo $entry_enquiry; ?></label>
<div class="col-sm-10">
<textarea name="enquiry" rows="10" id="input-enquiry" class="form-control"><?php echo $enquiry; ?></textarea>
<?php if ($error_enquiry) { ?>
<div class="text-danger"><?php echo $error_enquiry; ?></div>
<?php } ?>
</div>
</div>
<?php echo $captcha; ?>
</fieldset>
<div class="buttons">
<div class="pull-right">
<div class="g-recaptcha" data-sitekey="6LcivgwUAAAAADYVi7N2X7sQ1d29Wl1jnJfntQha"></div>
<input class="btn btn-primary" type="submit" value="<?php echo $button_submit; ?>" />
</div>
</div>
</form>
在Catalog/controller/Extension/captcha/basic-captcha.php
查找 $this->session->data['captcha'] = substr(sha1(mt_rand()), 17, 6);
将这段代码放在它后面。
// Editted by Foundlay
$out = ob_get_contents();
$out = str_replace(array("\n", "\r", "\t", " "), "",$this->session->data['captcha']);
ob_end_clean();
$this->session->data['captcha'] = $out;
这仅适用于 opencart 2.3.* 版本。
这是客户端集成。这是我的网站 www.festivetaste.com 连最基本的要点都没有出现。
以下是 contact.tpl 文件中的代码。
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" class="form-horizontal">
<fieldset>
<legend><?php echo $text_contact; ?></legend>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-name"><?php echo $entry_name; ?></label>
<div class="col-sm-10">
<input type="text" name="name" value="<?php echo $name; ?>" id="input-name" class="form-control" />
<?php if ($error_name) { ?>
<div class="text-danger"><?php echo $error_name; ?></div>
<?php } ?>
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-email"><?php echo $entry_email; ?></label>
<div class="col-sm-10">
<input type="text" name="email" value="<?php echo $email; ?>" id="input-email" class="form-control" />
<?php if ($error_email) { ?>
<div class="text-danger"><?php echo $error_email; ?></div>
<?php } ?>
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-enquiry"><?php echo $entry_enquiry; ?></label>
<div class="col-sm-10">
<textarea name="enquiry" rows="10" id="input-enquiry" class="form-control"><?php echo $enquiry; ?></textarea>
<?php if ($error_enquiry) { ?>
<div class="text-danger"><?php echo $error_enquiry; ?></div>
<?php } ?>
</div>
</div>
<?php echo $captcha; ?>
</fieldset>
<div class="buttons">
<div class="pull-right">
<div class="g-recaptcha" data-sitekey="6LcivgwUAAAAADYVi7N2X7sQ1d29Wl1jnJfntQha"></div>
<input class="btn btn-primary" type="submit" value="<?php echo $button_submit; ?>" />
</div>
</div>
</form>
在Catalog/controller/Extension/captcha/basic-captcha.php
查找 $this->session->data['captcha'] = substr(sha1(mt_rand()), 17, 6);
将这段代码放在它后面。
// Editted by Foundlay
$out = ob_get_contents();
$out = str_replace(array("\n", "\r", "\t", " "), "",$this->session->data['captcha']);
ob_end_clean();
$this->session->data['captcha'] = $out;
这仅适用于 opencart 2.3.* 版本。