Skip to content

rgenito/Kohana-2.3-reCAPTCHA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Updates or future development
===============================

	To contribute or download any possible updates, check this out: 
	
		https://github.com/rgenito/Kohana-2.3-reCAPTCHA

	Feel free to contact me any time: rgenito at proteushosting (dot net)


Installation
==============

	To install this module, just copy these files into your Kohana module directory.
	
	
Configuration
===============

	The configuration file is located in config/recaptcha.php. There you will setup your public key, private key, and option whether to use SSL or not. Get your public/private key from http://www.recaptcha.com.
	
	
Usage
=======

	1.) First, create a new reCAPTCHA object:
	
		$recapt = new Recaptcha;
		
	2.) Afterwards, on the website where you want to display the reCAPTCHA frame, do:
	
		$recapt->render();
		
	3.) While processing that page's POST request, you can check if the reCAPTCHA response was invalid like so:
	
		$recapt = new Recaptcha;
		if ($error_msg = $recapt->invalid())
		{
			echo "there was an error: $error_msg<br>";
			// bring user back to the form, asking them to re-try inputting the reCAPTCHA text
		}
		else
		{
			// process POST as normal
		}
		
	4.) During POST processing, if you want to check if your previous page asked for a user reCAPTCHA response:
	
		$recapt = new Recaptcha;
		if ($recapt->_isset())
		{
			echo "i sure hope you entered a response!";
		}


Example
=========

<html>
<body>

<?php
/**
 * Note: I don't even know if this example works...I just coded it real quick for the README's purpose :)
 */
$re = new Recaptcha;
if ($_POST)
{
	if ($re->_isset() && $re->invalid())
	{
		echo '<p style="font-color: #d00; font-weight: bold;">reCAPTCHA Response invalid: ';
		// display the actual error message
		echo $re->invalid();
		echo '</p>';
	}
	else
	{
		echo '<p style="font-color: #0d0; font-weight: bold;">Your response is correct! Good job!</p>';
	}
	echo '<p>Try again? :D</p>';
}
?>

<p>Let's play a fun game called "Enter-This-In-Correctly" :D</p>

<div>
	<?php echo $re->render(); ?>
</div>

</body>
</html>

About

reCAPTCHA library module for Kohana 2.3.x :D

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages