Captcha

The Captcha library allows you to display human verification security image to prevent automatic submissions by robots.

There is no need to access Captcha library directly, instead we can use Form helper and Validate class to display and check captcha value. For example our form may look like this:

<?=form_helper::openForm()?>
<?=form_helper::captcha('my_captcha')?>
<?=form_helper::error('my_captcha')?>
<?=form_helper::submit('submit', 'Submit')?>
<?=form_helper::closeForm()?>

And controller may look like this:

if ( input::postCount() )
{
	$rules = array(
		'my_captcha' => array(
			'label' => 'security image',
			'rules' => 'is_captcha'
		)
	);

	validate::setRules($rules);

	if ( validate::run() )
	{
		die("Success");
	}
}

view::load('my_form');