Captcha di form sangat penting ,hal ini berguna karena dapat mencegah terjadinya email spamming yang nantinya akan sangat mengganggu notifikasi di email, karena yang namanya spamming itu email robot otomatis dan gak pandang bulu mau berapa ratus bahkan berapa ribuan email g jelas masuk ke akun email kalian.
Nah dengan adanya captcha ini robot spamming bisanya kagak bisa sembarangan isi form hehe..
Captcha ini khusus opencart 1.5 x ya, yang belum ada captcha di form register akun dan register afiliasi.
Berikut ini langkah-langkah untuk menambah captcha di form register akun opencart 1.5.6 anda:
Tahap 1
Masuk ke : Catalog/view /theme/your theme use/template/account/register.tpl
Temukan kode di bawah ini
Temukan kode di bawah ini
<h2><?php echo $text_newsletter; ?></h2>
<div class="content">
<table class="form">
<tr>
<td><?php echo $entry_newsletter; ?></td>
<td><?php if ($newsletter == 1) { ?>
<input type="radio" name="newsletter" value="1" checked="checked" />
<?php echo $text_yes; ?>
<input type="radio" name="newsletter" value="0" />
<?php echo $text_no; ?>
<?php } else { ?>
<input type="radio" name="newsletter" value="1" />
<?php echo $text_yes; ?>
<input type="radio" name="newsletter" value="0" checked="checked" />
<?php echo $text_no; ?>
<?php } ?></td>
</tr>
</table>
</div>
kemudian masukan kode berikut ,dibawah kode td<div class="content">
<span class="required">*</span> <b><?php echo $entry_captcha; ?></b><br />
<input type="text" name="captcha" value="<?php echo $captcha; ?>" />
<br />
<img src="index.php?route=information/contact/captcha" alt="" />
<?php if ($error_captcha) { ?>
<span class="error"><?php echo $error_captcha; ?></span>
<?php } ?>
</div>
Tahap 2
Masuk Catalog/language/english/account/register.php
Temukan Kode berikut :
$_['entry_confirm'] = 'Password Confirm:';
Masukan kode ini dibawah kode tadi$_['entry_captcha'] = 'Enter the code in the box below:';
Kemudian cari kode ini
$_['error_agree'] = 'Warning: You must agree to the %s!';
dan masukan kode ini dibawah kode tadi$_['error_captcha'] = 'The captcha code was entered incorrectly, please try again!';
Tahap 3
Masuk Catalog/controller/account/register.php
Cari kode berikut :
$this->data['button_continue'] = $this->language->get('button_continue');
Masukan kode berikut dibawah kode tadi$this->data['entry_captcha'] = $this->language->get('entry_captcha');
Kemudian cari kode iniif (isset($this->error['zone'])) {
$this->data['error_zone'] = $this->error['zone'];
} else {
$this->data['error_zone'] = '';
}
masukan kode berikut dibawah kode tadiif (isset($this->error['captcha'])) {
$this->data['error_captcha'] = $this->error['captcha'];
} else {
$this->data['error_captcha'] = '';
}
Kemudian cari kode iniif (isset($this->request->post['newsletter'])) {
$this->data['newsletter'] = $this->request->post['newsletter'];
} else {
$this->data['newsletter'] = '';
}
masukan kode berikut dibawah kode tadiif (isset($this->request->post['captcha'])) {
$this->data['captcha'] = $this->request->post['captcha'];
} else {
$this->data['captcha'] = '';
}
Kemudian cari kode iniprivate function validate() {
if ((strlen(utf8_decode($this->request->post['firstname'])) < 1) || (strlen(utf8_decode($this->request->post['firstname'])) > 32)) {
$this->error['firstname'] = $this->language->get('error_firstname');
}
masukan kode berikut dibawah kode tadiif (!isset($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha'])) {
$this->error['captcha'] = $this->language->get('error_captcha');
}
Langkah terakhir cari kode iniif (!$this->error) {
return true;
} else {
return false;
}
}
masukan kode berikut dibawah kode tadipublic function captcha() {
$this->load->library('captcha');
$captcha = new Captcha();
$this->session->data['captcha'] = $captcha->getCode();
$captcha->showImage();
}
Nah selesai sudah ,silakan cek halaman akun register di web opencart anda, seharusnya sudah ada kolom captcha di formnya ^^Berikut ini screenshoot hasil captchanya tadi



0 Response to "Menambah Captcha di Form Register Opencart 1.5.6"
Post a Comment