Wednesday, November 3, 2010

Integrate open source secureimage library with CodeIgniter

Heres how:
1.) Download the open source securimage library from:
http://www.phpcaptcha.org/.

2.) Copy the library in your codeigniter’s application/library folder.

3.) Create a function in your codeigniter’s controller’s class (example index)

 function securimage() {$this->load->library('securimage');$img = new Securimage();$img->show(); // alternate use:  $img->show('/path/to/background.jpg');}

4.) In the view where you will place the captcha, insert this line:

<img src="<?=site_url('index/securimage')?>" alt='captcha' />

site_url() – gives the base url with index.php in the end
index – controller
securimage – is the function

No comments:

Post a Comment