

	List of changes made to cpg gallery for Registration recaptcha

	Author: Carver - 29 March 2009 | i-imagine.net | gallery.josephcarver.com |

	Mods and line numbers refer to: Coppermine version: 1.4.21	

_______________________________________________________________________

	FUNCTIOM: TO ADD RECAPTCHA PROTECTION TO CPG REGISTRATION - STOP SPAMMERS -

	INSTRUCTION: 
		
		1) Get keys and files from recaptcha.net 
			
			- public and private keys for your site(s)/domains - it's free
			
			- recaptchalib.php


		2) Backup then modify the file  register.php  Insert your public and private keys where shown
			
		- around line 194 - 196 the code will look like this


	<tr>
                <td colspan="2" align="center" class="tablef">
                        <input type="submit" name="submit" value="{$lang_register_php['submit']}" class="button" />




				
		- add the following to look like this (between 194-196)

	<tr>
		<td colspan="3" align="center" class="tablef"><br>Type the two words with a space. Then click 				Submit<br><br>
		<script>
		var RecaptchaOptions = {
  		 theme : 'white'};
		</script>
		<script type="text/javascript"
   		src="http://api.recaptcha.net/challenge?k=<YOUR PUBLIC RECAPTCHA KEY IN HERE>">
		</script>

		<noscript><h3> <br><u>YOU HAVE NO JAVASCRIPT</u>!<h3>
   		<iframe src="http://api.recaptcha.net/noscript?k=<YOUR PUBLIC RECAPTCHA KEY HERE>"
       		height="300" width="500" frameborder="0"></iframe><br>
   		<textarea name="recaptcha_challenge_field" rows="3" cols="40">
   		</textarea>
   		<input type="hidden" name="recaptcha_response_field" 
       		value="manual_challenge">
		</noscript>
				<br>Click Get a  new challenge (above) for new words<br></td></tr><tr>
		<td colspan="2" align="center" class="tablef">

		<input type="submit" name="submit" value="{$lang_register_php['submit']}" class="button" />





			
			- around line 285 the code will look like this

			    }

			    if ($CONFIG['reg_requires_valid_email'] || $CONFIG['admin_activation']) {



			- add the following to look like this (between 285-287)

			 
			}
				$errmssg = implode("", file('errmssg.html'));
        			require_once('recaptchalib.php');    
				$privatekey = "YOUR PRIVATE RECAPTCHA KEY HERE";
				$resp = recaptcha_check_answer ($privatekey,
				$_SERVER["REMOTE_ADDR"],
				$_POST["recaptcha_challenge_field"],
				$_POST["recaptcha_response_field"]);
				if (!$resp->is_valid) {
				die(header('Location: captcha_errmssg_reg.php'));

			   }

			   if ($CONFIG['reg_requires_valid_email'] || $CONFIG['admin_activation']) {


		
		3) Upload files:  captcha_errmssg_reg.php and recaptchalib.php  to your cpg root


		4) Upload the new modified register.php after backing up original


		5) Test and your registration process is now captcha protected from spambots


_______________________________________________________________________
	
	MODS, CHHANGES, ADD-ONS 


	1) register.php

		- add recaptcha javascript to form template

		- add recaptcha php to "hold" sending message if captcha error

	
	 
	
	2) captcha_errmssg_reg.php
		
		- add to cpg root
		
		- .js back to preserve form data
	

	3) misc.
		
		- formatting for author's themes preserved in demo. mods,
		  users modify as seen fit

_______________________________________________________________________

	KNOWN ISSUES

	1) ie7 shows misplaced alignment on ERROR PAGE - functions are good
		- will not be fixed by author

________________________________________________________________________

	NOTES: 

	1) Users need a Public and Private key set from recaptcha.net BEFORE applying the mods 

	2) Users should test their own recaptcha key responses with the recaptcha.net test examples
	before trying this on a live gallery 

	3) There is no support for these mods, but the author is wiling to share experience 

	4) Feedback/suggestions are welcome

	5) Improvements/to be done 
			- change response so user is kept on reg. page
			- format/style flexibility
			- lang. suppport (recaptcha.net has limited lang. support)		


________________________________________________________________________



