Come And Feel the Difference

Full Version: Add reCaptcha on Lost password Page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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/downl...lib-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