an enhanced captcha as helper - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: an enhanced captcha as helper (/showthread.php?tid=3375) |
an enhanced captcha as helper - El Forum - 09-27-2007 [eluser]Christian Rößler[/eluser] Hy folks, having played around with CI (for the first time) in a new project i found out that the shipped captcha-plugin did not fit my needs. so i wrote a new captcha (after i wasn't able to find one on this site) - as helper - with support for: - random background-colors - random char-colors - multiple font-files (ttf as before) - set the font-size via config The return-value is exactly the same as CI's captcha-plugin's. create_captcha($config) returns an array with the html-img-tag, a timestamp and the word itself. put the captcha_helper.php into Code: /system/application/helpers/ Code: $this->load->helper('captcha'); you will find the helper here: captcha_helper.php.tar.gz feel free to make changes / enhancements and share your work! bye, chris PS: CI rocks! an enhanced captcha as helper - El Forum - 09-27-2007 [eluser]mironcho[/eluser] Thanks Christian! an enhanced captcha as helper - El Forum - 09-30-2007 [eluser]Christian Rößler[/eluser] hy, had a small typo, feel free to get the newest version from the same location as above. an enhanced captcha as helper - El Forum - 10-27-2007 [eluser]JP X3M[/eluser] very n00bish question... how do i add this to my site? thanks... i have not yet tried the built in captcha plugin, but upon reading this seems to be an improvement of the plugin so i wanna implement it also... thanks so much! an enhanced captcha as helper - El Forum - 10-27-2007 [eluser]mironcho[/eluser] Hi JP X3M Have you read Christian Rößler post carefully? You must create system/application/helpers/ folder and put captcha_helper in. Then load it and use it as is described in first post an enhanced captcha as helper - El Forum - 10-27-2007 [eluser]JP X3M[/eluser] i did excatly that and then in my register controller i have these settings... Code: function index(){ then i tried print_r($aCaptchaCfg) and it outputs the array so i guess it should be okay... next should i echo it or anything? thanks for your help! UPDATE: oh im so sorry i forgot to read the original catpcha plugin... i read it just now and i will try it first... thanks for your help though... ^__^ an enhanced captcha as helper - El Forum - 10-29-2007 [eluser]Christian Rößler[/eluser] Hy 'JP X3M', First create a folder called Code: helpers Code: /system/application/ Then copy the helper-file into this directory. After that create a writeable folder where the generated captcha-images will reside in: Code: /captcha/ Your example folder structure: Code: /system/ If you use apache's mod rewrite to hide index.php from your url, edit .htaccess to allow clients access to the captcha directory! Finally write your controller (an example): Code: function index(){ Code: /system/fonts/ Here is an example-view (really simple). You'll have to improve this by using a form and validate the input (the captcha-word typed in by the user) and compare it with the generated captcha-secret. Code: <html> There are 3 keys in the generated Captcha-array: Code: $aCaptcha['image'] Code: $aCaptcha['word'] Code: $aCaptcha['time'] Get more fonts here: http://www.fontasy.de/ (for example) or here: google -> 'free fonts' an enhanced captcha as helper - El Forum - 10-29-2007 [eluser]JP X3M[/eluser] thanks... i finally got it to output the captcha image... thanks! an enhanced captcha as helper - El Forum - 05-08-2008 [eluser]JOKERz[/eluser] miss type line 65 Code: if( !isset($aCfg['img_heigtht']) OR $aCfg['img_height'] == '') height not heigtht an enhanced captcha as helper - El Forum - 05-20-2008 [eluser]Unknown[/eluser] I followed the example above with the following code. It doesnt seem to work for me. I dont even get a print_r() ! My directory structure is as follows: img_path = http://localhost/Paradise Calling/common/captcha/ img_url = http://localhost/Paradise Calling/common/captcha/ font_path = http://localhost/Paradise Calling/application/fonts/ Am I supposed to add place an image in one of those dirs or something? The captcha helper is located at: http://localhost/Paradise Calling/application/helpers/ Code: // Index page My View code: Code: captcha-test:<br/> Ive made sure my paths are correct for img_path, img_url, font_path Whats the problem with this? |