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 'Good answer!
';
}
else
{
echo 'Wrong answer!
';
}
}
// 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
文章標籤
全站熱搜
