Kohana Captcha module - securimage

Well...Maybe it's an unnecessary library in Kohana,but I still try to make it be module.
The original source from http://www.phpcaptcha.org/,so It's GNU LESSER GENERAL PUBLIC LICENSE
呃…或許這個模組在Kohana是多餘的,但是我還是把他做出來了= =,他一樣是用http://www.phpcaptcha.org/的原始碼修改的,所以授權一樣是LGPL
Usage Sample:

class Welcome_Controller extends Controller {
	public function __construct()
	{
		parent::__construct();
	}
	public function index()
	{
		// Load Securimage library
		$this->securimage = new Securimage;
 
		// Form submitted
		if ($_POST)
		{
			$imageCode = $this->input->post('imageCode');
			echo $this->securimage->getCode();
			if ($this->securimage->check($imageCode)==true)
			{
				echo '<p style="color:green">Good answer!</p>';
			}
			else
			{
				echo '<p style="color:red">Wrong answer!</p>';
			}
		}
 
		// Show form
		echo form::open();
		echo html::image('image/securimage',null,true);
		echo form::input('imageCode');
		echo form::submit(array('value' => 'Check'));
		echo form::close();
	}
} // End Welcome Controller


Image Controller

class Image_Controller extends Controller {
	public function __construct()
	{
		parent::__construct();
	}
	public function securimage()
	{
		$this->securimage = new Securimage;
		$this->securimage->show();
	}
}

Download:securimage module

五月 20, 2009 • Posted in: Kohana, 程式語言

2 Responses to “Kohana Captcha module - securimage”

  1. Dion Moult - 七月 13, 2009

    I was going to implement securimage on my Kohana-run website and this really sped things up! Thank you so much!

  2. ITelekom - 九月 22, 2009

    ужос!!!

回應(Leave a Reply)