Back to vBulletin 3.6 Add-ons

reCAPTCHA!vB - Stop spam. Read books.
Mod Version: 1.1.0, by magnus

This modification is in the archives.
vB Version: 3.6.7 Rating: (24 votes - 4.88 average) Installs: 207
Released: 10 Jul 2007 Last Update: 28 Feb 2008 Downloads: 2228
Not Supported Uses Plugins Auto-Template Code Changes Additional Files External Content  

THIS MODIFICATION SHOULD NOT BE USED WITH VBULLETIN 3.7+ AS IT IS A DEFAULT FEATURE.

Keywords: reCAPTCHA, CAPTCHA, spam, register

Description:
This modification will replaced the default vBulletin registration CAPTCHA with the newer, more advanced reCAPTCHA.

What is CAPTCHA/reCAPTCHA?:
A CAPTCHA is a program that can tell whether its user is a human or a computer. You've probably seen them — colorful images with distorted text at the bottom of Web registration forms. CAPTCHAs are used by many websites to prevent abuse from "bots," or automated programs usually written to generate spam. No computer program can read distorted text as well as humans can, so bots cannot navigate sites protected by CAPTCHAs.

About 60 million CAPTCHAs are solved by humans around the world every day. In each case, roughly ten seconds of human time are being spent. Individually, that's not a lot of time, but in aggregate these little puzzles consume more than 150,000 hours of work each day. What if we could make positive use of this human effort? reCAPTCHA does exactly that by channeling the effort spent solving CAPTCHAs online into "reading" books.

To archive human knowledge and to make information more accessible to the world, multiple projects are currently digitizing physical books that were written before the computer age. The book pages are being photographically scanned, and then, to make them searchable, transformed into text using "Optical Character Recognition" (OCR). The transformation into text is useful because scanning a book produces images, which are difficult to store on small devices, expensive to download, and cannot be searched. The problem is that OCR is not perfect.



reCAPTCHA improves the process of digitizing books by sending words that cannot be read by computers to the Web in the form of CAPTCHAs for humans to decipher. More specifically, each word that cannot be read correctly by OCR is placed on an image and used as a CAPTCHA. This is possible because most OCR programs alert you when a word cannot be read correctly.

But if a computer can't read such a CAPTCHA, how does the system know the correct answer to the puzzle? Here's how: Each new word that cannot be read correctly by OCR is given to a user in conjunction with another word for which the answer is already known. The user is then asked to read both words. If they solve the one for which the answer is known, the system assumes their answer is correct for the new one. The system then gives the new image to a number of other people to determine, with higher confidence, whether the original answer was correct.

Currently, we are helping to digitize books from the http://www.archive.org/.



Installation:
  1. Download and unzip the recaptcha101.zip archive.
  2. Upload the functions_recaptcha.php to your /includes/ directory.
  3. Import the product-recaptcha.xml via the Product Manager.
  4. Obtain a FREE public and private reCAPTCHA key https://admin.recaptcha.net/accounts/signup/.
  5. Make any desired configuration changes via AdminCP > vBulletin Options > reCAPTCHA Options
  6. Make a backup of your register.php file, located in your forum root.
  7. Perform ONE (1) of the following methods:
    • Method A:
      • Download the register-patch.zip archive, extract, then upload the register.patch file to your forum root, then apply the patch:

        *Note: Please note that this method requires a basic understanding of UNIX shell commands and requires shell access to your host. If you do not have either of these or you are unsure how to use GNU patch, I highly suggest performing Method B instead)

        Code:
        # patch -b register.php < register.patch
        This will perform the file edits automatically. Once finished, you may delete the register.patch file.
    • Method B:
      Perform the following simple file edits:
      • IN register.php:
        1. FIND:
          PHP Code:
          eval('$imagereg = "' fetch_template('imagereg') . '";'); 
          REPLACE WITH:
          PHP Code:
          $imagereg recaptcha_get_html($vbulletin->options['recaptcha_publickey'], $error); 
        2. FIND AND REMOVE:
          PHP Code:
                          'imagestamp'          => TYPE_STR,
                          
          'imagehash'           => TYPE_STR
        3. FIND:
          PHP Code:
                  // Check Reg Image
                  
          if ($vbulletin->options['regimagecheck'] AND $vbulletin->options['regimagetype'])
                  {
                          require_once(
          DIR '/includes/functions_regimage.php');
                          if (!
          verify_regimage_hash($vbulletin->GPC['imagehash'], $vbulletin->GPC['imagestamp']))
                          {
                                  
          $userdata->error('register_imagecheck');
                          }
                  } 
          REPLACE WITH:
          PHP Code:
                  // Check Reg Image
                  
          if ($vbulletin->options['regimagecheck'] AND $vbulletin->options['regimagetype'])
                  {
                          
          $resp recaptcha_check_answer ($vbulletin->options['recaptcha_privatekey'],
                                                          
          $_SERVER["REMOTE_ADDR"],
                                                          
          $_POST["recaptcha_challenge_field"],
                                                          
          $_POST["recaptcha_response_field"]);

                          if (!
          $resp->is_valid)
                          {
                                  
          $userdata->error('register_imagecheck');
                          }
                  } 

NOTE: YOU MAY ALSO REPLACE THE CAPTCHA DISPLAYED TO GUESTS WHEN USING THE "CONTACT US" FORM BY FOLLOWING THE INSTRUCTIONS HERE

Spoiler (click to open)


Perform the following file edits in order to replace the default CAPTCHA displayed to guests when using "Contact Us" with a reCAPTCHA


In sendmessage.php - BE SURE TO MAKE A BACKUP BEFORE EDITING!
  1. FIND:
    PHP Code:
        if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['contactustype'] == AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_regimage.php');
            if (!
    verify_regimage_hash($vbulletin->GPC['imagehash'], $vbulletin->GPC['imagestamp']))
            {
                
    $errors[] = fetch_error('register_imagecheck');
            }
        } 
    REPLACE WITH:
    PHP Code:
        if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['contactustype'] == AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_recaptcha.php');
            
    $resp recaptcha_check_answer($vbulletin->options['recaptcha_privatekey'],
                            
    $_SERVER["REMOTE_ADDR"],
                            
    $_POST["recaptcha_challenge_field"],
                            
    $_POST["recaptcha_response_field"]);
            if (!
    $resp->is_valid)
            {
                
    $errors[] = fetch_error('register_imagecheck');
            }
        } 
  2. FIND AND REMOVE:
    PHP Code:
            if ($imagehash)
            {
                
    $db->query_write("DELETE FROM " TABLE_PREFIX "regimage WHERE regimagehash = '" $db->escape_string($imagehash) . "'");
            } 
  3. FIND:
    PHP Code:
        if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['contactustype'] == AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_regimage.php');
            
    $imagehash fetch_regimage_hash();
            eval(
    '$imagereg = "' fetch_template('imagereg') . '";');
        } 
    REPLACE WITH:
    PHP Code:
        if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['contactustype'] == AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_recaptcha.php');
            
    $imagereg recaptcha_get_html($vbulletin->options['recaptcha_publickey']);
        } 
  4. FIND:
    PHP Code:
        // image verification
        
    if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_regimage.php');
            
    $imagehash fetch_regimage_hash();
            eval(
    '$imagereg = "' fetch_template('imagereg') . '";');
        } 
    REPLACE WITH:
    PHP Code:
        // image verification
        
    if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_recaptcha.php');
            
    $imagereg recaptcha_get_html($vbulletin->options['recaptcha_publickey']);
        } 
  5. FIND:
    PHP Code:
        if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_regimage.php');
            if (!
    verify_regimage_hash($vbulletin->GPC['imagehash'], $vbulletin->GPC['imagestamp']))
            {
                
    standard_error(fetch_error('register_imagecheck'));
            }
        } 
    REPLACE WITH:
    PHP Code:
        if (!$vbulletin->userinfo['userid'] AND $vbulletin->options['regimagetype'])
        {
            require_once(
    DIR '/includes/functions_recaptcha.php');

            
    $resp recaptcha_check_answer ($vbulletin->options['recaptcha_privatekey'],
                            
    $_SERVER["REMOTE_ADDR"],
                            
    $_POST["recaptcha_challenge_field"],
                            
    $_POST["recaptcha_response_field"]);

            if (!
    $resp->is_valid)
            {
                
    standard_error(fetch_error('register_imagecheck'));
            }
        } 
  6. FIND AND REMOVE: THERE WILL BE TWO (2) OCCURANCES OF THIS STRING. REMOVE BOTH
    PHP Code:
            'imagestamp'    => TYPE_STR,
            
    'imagehash'     => TYPE_STR

Close
.




Tips, tricks and modifications:
  • Apply "Method A" without shell access

    Spoiler (click to open)


    For those who would like to use "Method A" (the register.patch file) to modify their register.php file but do not have shell access (e.g. hosting services that only provide cPanel access), you may find this "trick" useful:

    1. Upload the register.patch file to your forum's root directory.

    2. Create a plain text file called runpatch.pl with the following contents:

    Code:
    #!/usr/bin/perl
    print "content-type:text/html\n\n";
    system('patch -b register.php < register.patch');

    save it, and upload it to your forum's root directory.

    3. Change the permissions on the runpatch.pl file that you just uploaded to 0755 so that you can execute the script.

    4. In a web browser, type:

    http://yourdomain/yourforum/runpatch.pl

    The perl script will run, which in turn runs the patch command.

    5. Delete the runpatch.pl file from your forum's root directory.

    N.B.: This technique assumes that you can run perl scripts with system calls on the server where your forum resides, which is usually the case.

    - Dan

    Close
    (DOCTOR DAN)
  • Restore "image verification" frame around reCAPTCHA panel

    Spoiler (click to open)


    A quick mod if you want to restore the "image verification" frame around the reCAPTCHA panel, just like how vBulletin's standard CAPTCHA panel appears:

    In the template register find:

    Code:
    $imagereg

    and replace it with:

    Code:
    <fieldset class="fieldset">
    	<legend> $vbphrase[image_verification] </legend>
    	$imagereg
    </fieldset>

    You can also center the reCAPTCHA panel within the frame by adding a "<center>" tag:

    Code:
    <fieldset class="fieldset">
    	<legend> $vbphrase[image_verification] </legend>
    	<center> $imagereg </center>
    </fieldset>

    - Dan
    Attached Thumbnails
    Click image for larger version
Name:	1.jpg
Views:	99
Size:	45.9 KB
ID:	75940   Click image for larger version
Name:	2.jpg
Views:	121
Size:	51.5 KB
ID:	75941   Click image for larger version
Name:	3.jpg
Views:	104
Size:	52.1 KB
ID:	75942   Click image for larger version
Name:	4.jpg
Views:	104
Size:	51.3 KB
ID:	75943  


    Close
    (DOCTOR DAN)



Comments:
As with all my hacks, this modification is provided free of charge. However, if you find this product useful and have money burning a hole in your pocket, feel free to make a small https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=magn2o%40comcast%2enet&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8, I won't mind.. really.

Version History:
  • 1.0.0 - Initial release, here's to hoping...
  • 1.0.1 - Woops! Forgot to include a aesthetic template edit in the original release. All is well, simply redownload and overwrite the XML. That's it!
  • 1.1.0 - Added alternate language support. Now various reCAPTCHA tags and text will be displayed in your selected language. Also added a fieldset to the automatic template edits around the display block for a more uniform look (thanks DOCTOR DAN!).

Currently Known Bugs:
  • None

* Please note that this modification was developed on a forum with a userbase of 1 (myself). I've tested it for basic functionality but I cannot guarantee functionality or behavior on your forum. So, please -- make backups before installing this product!

Download

This modification is archived, downloads are still allowed.

File Type: %1$s register-patch.zip (625 Bytes, 1008 downloads)
File Type: %1$s recaptcha110.zip (5.5 KB, 1307 downloads)

Screenshots

Click image for larger version
Name:	captchaHomePage.gif
Views:	1232
Size:	8.3 KB
ID:	66750   Click image for larger version
Name:	recaptchaadmin.jpg
Views:	1002
Size:	81.8 KB
ID:	66792   Click image for larger version
Name:	recaptchavb.jpg
Views:	863
Size:	52.1 KB
ID:	76450  

Similar Mods

Miscellaneous Hacks reCAPTCHA!vB - MailHide : Tired of spam? Fight back. vBulletin 3.6 Add-ons

vblts.ru supports vBulletin®, 2022-2024