Come And Feel the Difference
[Tips & Trik] Add reCaptcha on Lost password Page - Printable Version

+- Come And Feel the Difference (https://www.gookil.com/x2)
+-- Forum: Cyberspace (https://www.gookil.com/x2/forum-18.html)
+--- Forum: MyBB (https://www.gookil.com/x2/forum-151.html)
+--- Thread: [Tips & Trik] Add reCaptcha on Lost password Page (/thread-374.html)



Add reCaptcha on Lost password Page - Terzier - 12-29-2011

This trick was written by Dennis Tsang on mybb.com

aku rasa, thread ini sangatlah penting. mengingat semakin banyaknya spammer yang berkeliaran di MyBB :mata_sipit:

trik ini, akan menambahkan kolom reCaptcha kedalam field Lost Password MyBB.

sebelumnya, file yang dibutuhkan harus di unduh dulu.
http://code.google.com/p/recaptcha/downloads/list?q=label:phplib-Latest
atau, download file attacment berikut :
[attachment=15]

setelah itu, tempatkan recaptchalib.php di folder /inc di forum Anda.

masuk ke member.php, cari:
PHP Code:
$plugins->run_hooks("member_lostpw"); 

dibawah kode itu, tambahkan...
PHP Code:
require_once('inc/recaptchalib.php');
$publickey "your_public_key"// you got this from the signup page
$recaptcha_code recaptcha_get_html($publickey); 
You need to replace your_public_key with your recaptcha API key.

Find:
PHP Code:
$plugins->run_hooks("member_do_lostpw_start"); 

Below it, add:
PHP Code:
require_once('inc/recaptchalib.php');
  
$privatekey "your_private_key";
  
$resp recaptcha_check_answer ($privatekey,
                                
get_ip(),
                                
$_POST["recaptcha_challenge_field"],
                                
$_POST["recaptcha_response_field"]);

  if (!
$resp->is_valid) {
    
// What happens when the CAPTCHA was entered incorrectly
    
error('Die bots!!!!');
  } 
You need to replace your_private_key with your recaptcha API keys.

In your member_lostpw template, find:
Code:
<tr>
<td class="trow1" width="40%"><strong>{$lang->email_address}</strong></td>
<td class="trow1" width="60%"><input type="text" class="textbox" name="email" /></td>
</tr>
Below it, add:
Code:
<tr>
<td class="trow2"><strong>Are you human?</strong></td>
<td class="trow2">{$recaptcha_code}</td>
</tr>

Credits: Denis Tsang