{"id":1682,"date":"2016-07-07T17:48:43","date_gmt":"2016-07-07T17:48:43","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=1682"},"modified":"2018-05-14T19:51:38","modified_gmt":"2018-05-14T19:51:38","slug":"implement-captcha-codeigniter-captcha-helper","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/","title":{"rendered":"How to Implement Captcha in CodeIgniter using Captcha Helper"},"content":{"rendered":"<p>A CAPTCHA (Complete Automated Public Turning test to tell Computer and Human Apart) is a type of challenge test to identify whether the user is human or not. Captcha mostly used in the web application to protect the website from getting spammed. A captcha is very important in the web form where any input is given by the user or any action is processed based on the user&#8217;s response.<\/p>\n<p>CAPTCHA is randomly generated string incorporated in an image file which is display to the user and the random string is stored in SESSION variable. Once the user submits the captcha word by viewing captcha image, the submitted value will be compared with the session value. If both the captcha code is matched, further action should take.<\/p>\n<p>In this tutorial, we will show you how to <b>implement CAPTCHA in CodeIgniter<\/b>. CodeIgniter provides a CAPTCHA helper to generate random code and create CAPTCHA image. <b>CodeIgniter CAPTCHA Helper<\/b> contains functions that help to generate CAPTCHA images with various customization options.<\/p>\n<p>Here we&#8217;ll provide the example code to implement CAPTCHA functionality in CodeIgniter. The following functionality will be implemented in this <a href=\"http:\/\/www.codexworld.com\/simple-php-captcha-using-codexworldcaptcha\/\">simple PHP captcha script<\/a> for CodeIgniter.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Create and display captcha image.<\/li>\n<li>Get user input and submit for comparison.<\/li>\n<li>Compare user input code with captcha word and return the status.<\/li>\n<\/li>\n<\/ul>\n<h2>Create CAPTCHA Image in CodeIgniter<\/h2>\n<p>To create captcha image, you need to specify the config options and pass this array in <code>create_captcha()<\/code> function of CAPTCHA helper.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;Captcha&nbsp;configuration<br><\/span><span style=\"color: #0000BB\">$config&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_path'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'captcha_images\/'<\/span><span style=\"color: #007700\">,<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_url'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">base_url<\/span><span style=\"color: #007700\">().<\/span><span style=\"color: #DD0000\">'captcha_images\/'<\/span><span style=\"color: #007700\">,<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_width'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'150'<\/span><span style=\"color: #007700\">,<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_height'&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">50<\/span><span style=\"color: #007700\">,<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'word_length'&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">8<\/span><span style=\"color: #007700\">,<br>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'font_size'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">16<br><\/span><span style=\"color: #007700\">);<br><\/span><span style=\"color: #0000BB\">$captcha&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">create_captcha<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$config<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<h2>Implement CAPTCHA Functionality in CodeIgniter<\/h2>\n<p>Now we will show how you can use this captcha code and implement captcha functionality in your CodeIgniter 3 application.<\/p>\n<h2>Controller (Captcha.php)<\/h2>\n<p>The Captcha controller contains 3 functions, <code>__construct()<\/code>, <code>index()<\/code>, and <code>refresh()<\/code>.<\/p>\n<p><b><code>__construct()<\/code><\/b><\/p>\n<ul class=\"bullet_disk_list\">\n<li>Load the CodeIgniter CAPTCHA helper to generate captcha code and image. <\/li>\n<li>Load the Session library to store captcha code for comparison.<\/li>\n<\/ul>\n<p><b><code>index()<\/code><\/b><\/p>\n<ul class=\"bullet_disk_list\">\n<li>Generate random word and create captcha image using create_captcha() function. <\/li>\n<li>Store captcha code in a SESSION variable.<\/li>\n<li>Pass captcha image to view and load the view.<\/li>\n<li>Handles the captcha code submission and comparison process.<\/li>\n<\/ul>\n<p><b><code>refresh()<\/code><\/b><br \/>\nGenerate random word, create and display captcha image. Basically, this function is called when the user request for a new captcha.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;defined<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'BASEPATH'<\/span><span style=\"color: #007700\">)&nbsp;OR&nbsp;exit(<\/span><span style=\"color: #DD0000\">'No&nbsp;direct&nbsp;script&nbsp;access&nbsp;allowed'<\/span><span style=\"color: #007700\">);<br \/>class&nbsp;<\/span><span style=\"color: #0000BB\">Captcha&nbsp;<\/span><span style=\"color: #007700\">extends&nbsp;<\/span><span style=\"color: #0000BB\">CI_Controller<br \/><\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">__construct<\/span><span style=\"color: #007700\">()&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">parent<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">__construct<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Load&nbsp;session&nbsp;library<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">load<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">library<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'session'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Load&nbsp;the&nbsp;captcha&nbsp;helper<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">load<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">helper<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captcha'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">index<\/span><span style=\"color: #007700\">(){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;If&nbsp;captcha&nbsp;form&nbsp;is&nbsp;submitted<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if(<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">input<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">post<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'submit'<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$inputCaptcha&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">input<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">post<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captcha'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$sessCaptcha&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">session<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">userdata<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captchaCode'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">$inputCaptcha&nbsp;<\/span><span style=\"color: #007700\">===&nbsp;<\/span><span style=\"color: #0000BB\">$sessCaptcha<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'Captcha&nbsp;code&nbsp;matched.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'Captcha&nbsp;code&nbsp;does&nbsp;not&nbsp;match,&nbsp;please&nbsp;try&nbsp;again.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Captcha&nbsp;configuration<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$config&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_path'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'captcha_images\/'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_url'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">base_url<\/span><span style=\"color: #007700\">().<\/span><span style=\"color: #DD0000\">'captcha_images\/'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'font_path'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'system\/fonts\/texb.ttf'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_width'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'160'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_height'&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">50<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'word_length'&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">8<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'font_size'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">18<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$captcha&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">create_captcha<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$config<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Unset&nbsp;previous&nbsp;captcha&nbsp;and&nbsp;set&nbsp;new&nbsp;captcha&nbsp;word<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">session<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">unset_userdata<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captchaCode'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">session<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">set_userdata<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captchaCode'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$captcha<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'word'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Pass&nbsp;captcha&nbsp;image&nbsp;to&nbsp;view<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$data<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'captchaImg'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #0000BB\">$captcha<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'image'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Load&nbsp;the&nbsp;view<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">load<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">view<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captcha\/index'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$data<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">refresh<\/span><span style=\"color: #007700\">(){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Captcha&nbsp;configuration<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$config&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_path'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'captcha_images\/'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_url'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">base_url<\/span><span style=\"color: #007700\">().<\/span><span style=\"color: #DD0000\">'captcha_images\/'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'font_path'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'system\/fonts\/texb.ttf'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_width'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'160'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'img_height'&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">50<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'word_length'&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">8<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'font_size'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">18<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$captcha&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">create_captcha<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$config<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Unset&nbsp;previous&nbsp;captcha&nbsp;and&nbsp;set&nbsp;new&nbsp;captcha&nbsp;word<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">session<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">unset_userdata<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captchaCode'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">session<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">set_userdata<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'captchaCode'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$captcha<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'word'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Display&nbsp;captcha&nbsp;image<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$captcha<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'image'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>}<\/span><\/pre>\n<h2>View (captcha\/index.php)<\/h2>\n<p>Initially, the captcha image is shown with an input field and submit button. Once the user submits the captcha word it will be sent to the <code>index()<\/code> method of Captcha controller for comparison.<\/p>\n<pre style=\"background:#f9f9f9;color:#080808\">&lt;<span style=\"color:#bf4f24\">h4<\/span>>Submit Captcha Code&lt;\/<span style=\"color:#bf4f24\">h4<\/span>>\r\n&lt;<span style=\"color:#bf4f24\">p<\/span> <span style=\"color:#bf4f24\">id<\/span><span style=\"color:#794938\">=<\/span><span style=\"color:#0b6125\">\"captImg\"<\/span>><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$captchaImg<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>&lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n&lt;<span style=\"color:#bf4f24\">p<\/span>>Can't read the image? click &lt;<span style=\"color:#bf4f24\">a<\/span> <span style=\"color:#bf4f24\">href<\/span>=<span style=\"color:#0b6125\">\"javascript:void(0);\"<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"refreshCaptcha\"<\/span>>here&lt;\/<span style=\"color:#bf4f24\">a<\/span>> to refresh.&lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n&lt;<span style=\"color:#bf4f24\">form<\/span> <span style=\"color:#bf4f24\">method<\/span>=<span style=\"color:#0b6125\">\"post\"<\/span>>\r\n    Enter the code : \r\n    &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">name<\/span>=<span style=\"color:#0b6125\">\"captcha\"<\/span> <span style=\"color:#bf4f24\">value<\/span>=<span style=\"color:#0b6125\">\"\"<\/span>\/>\r\n    &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"submit\"<\/span> <span style=\"color:#bf4f24\">name<\/span>=<span style=\"color:#0b6125\">\"submit\"<\/span> <span style=\"color:#bf4f24\">value<\/span>=<span style=\"color:#0b6125\">\"SUBMIT\"<\/span>\/>\r\n&lt;\/<span style=\"color:#bf4f24\">form<\/span>>\r\n<\/pre>\n<p>Also, the user can request a new captcha image by refresh link. The jQuery and Ajax code will execute by clicking the refresh link. The new captcha image will be fetched from the <code>refresh()<\/code> method of Captcha controller and the existing captcha image will be replaced with a new image.<\/p>\n<pre style=\"background:#f9f9f9;color:#080808\"><span style=\"color:#5a525f;font-style:italic\">&lt;!-- jQuery library --><\/span>\r\n&lt;<span style=\"color:#bf4f24\">script<\/span> <span style=\"color:#bf4f24\">src<\/span>=<span style=\"color:#0b6125\">\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.3.1\/jquery.min.js\"<\/span>>&lt;\/<span style=\"color:#bf4f24\">script<\/span>>\r\n\r\n<span style=\"color:#5a525f;font-style:italic\">&lt;!-- captcha refresh code --><\/span>\r\n&lt;<span style=\"color:#bf4f24\">script<\/span>>\r\n<span style=\"color:#691c97\">$<\/span>(<span style=\"color:#691c97\">document<\/span>)<span style=\"color:#693a17\">.ready<\/span>(<span style=\"color:#a71d5d;font-style:italic\">function<\/span>(){\r\n    <span style=\"color:#691c97\">$<\/span>('<span style=\"color:#bf4f24\">.refreshCaptcha<\/span>').on(<span style=\"color:#0b6125\">'click'<\/span>, <span style=\"color:#a71d5d;font-style:italic\">function<\/span>(){\r\n        <span style=\"color:#794938\">$<\/span><span style=\"color:#693a17\">.get<\/span>(<span style=\"color:#0b6125\">'&lt;?php echo base_url().'<\/span>captcha\/refresh<span style=\"color:#0b6125\">'; ?>'<\/span>, <span style=\"color:#a71d5d;font-style:italic\">function<\/span>(data){\r\n            <span style=\"color:#691c97\">$<\/span>('<span style=\"color:#bf4f24\">#captImg<\/span>')<span style=\"color:#693a17\">.html<\/span>(data);\r\n        });\r\n    });\r\n});\r\n&lt;\/<span style=\"color:#bf4f24\">script<\/span>>\r\n<\/pre>\n<h2>CAPTCHA Configuration Options<\/h2>\n<p>Various configuration options are available in create_captcha() function to customize the captcha image. Some useful configuration options are given below:<\/p>\n<ul class=\"bullet_disk_list\">\n<li>img_path &#8211; Required. The path where the captcha images will be stored.<\/li>\n<li>img_url &#8211; Required. The URL of the captcha image.<\/li>\n<li>img_width &#8211; Optional. The width of the captcha image. Defaults to 150.<\/li>\n<li>img_height &#8211; Optional. The height of the captcha image. Defaults to 30.<\/li>\n<li>word_length &#8211; Optional. The number of characters. Defaults to 8.<\/li>\n<li>font_size &#8211; Optional. The font size of the captcha word. Defaults to 16.<\/li>\n<li>font_path &#8211; Optional. The path of text font. Specify the font path, if you want to use different text font for captcha word.<\/li>\n<li>pool &#8211; Optional. Defaults to &#39;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#39;. Specify the letters which you want to use in the captcha code.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A CAPTCHA (Complete Automated Public Turning test to tell Computer and Human Apart) is a type of challenge test to identify whether the user is human or not. Captcha mostly used in the web application <\/p>\n","protected":false},"author":1,"featured_media":1683,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[208,55],"class_list":["post-1682","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codeigniter","tag-captcha","tag-codeigniter","cat-8-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Implement Captcha in CodeIgniter using Captcha Helper - CodexWorld<\/title>\n<meta name=\"description\" content=\"CodeIgniter CAPTCHA Helper \u2013 Tutorial on how to implement captcha in CodeIgniter. Simple code to create captcha image in CodeIgniter using captcha Helper. Use create_captcha() function to generate captcha code and configure captcha image in CodeIgniter.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Implement Captcha in CodeIgniter using Captcha Helper - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"CodeIgniter CAPTCHA Helper \u2013 Tutorial on how to implement captcha in CodeIgniter. Simple code to create captcha image in CodeIgniter using captcha Helper. Use create_captcha() function to generate captcha code and configure captcha image in CodeIgniter.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-07T17:48:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-05-14T19:51:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/07\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"How to Implement Captcha in CodeIgniter using Captcha Helper\",\"datePublished\":\"2016-07-07T17:48:43+00:00\",\"dateModified\":\"2018-05-14T19:51:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/\"},\"wordCount\":583,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/07\\\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png\",\"keywords\":[\"Captcha\",\"CodeIgniter\"],\"articleSection\":[\"CodeIgniter\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/\",\"name\":\"How to Implement Captcha in CodeIgniter using Captcha Helper - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/07\\\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png\",\"datePublished\":\"2016-07-07T17:48:43+00:00\",\"dateModified\":\"2018-05-14T19:51:38+00:00\",\"description\":\"CodeIgniter CAPTCHA Helper \u2013 Tutorial on how to implement captcha in CodeIgniter. Simple code to create captcha image in CodeIgniter using captcha Helper. Use create_captcha() function to generate captcha code and configure captcha image in CodeIgniter.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/07\\\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/07\\\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png\",\"width\":1366,\"height\":768,\"caption\":\"how-to-implement-captcha-in-codeigniter-using-captcha-helper\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/implement-captcha-codeigniter-captcha-helper\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Implement Captcha in CodeIgniter using Captcha Helper\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Implement Captcha in CodeIgniter using Captcha Helper - CodexWorld","description":"CodeIgniter CAPTCHA Helper \u2013 Tutorial on how to implement captcha in CodeIgniter. Simple code to create captcha image in CodeIgniter using captcha Helper. Use create_captcha() function to generate captcha code and configure captcha image in CodeIgniter.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/","og_locale":"en_US","og_type":"article","og_title":"How to Implement Captcha in CodeIgniter using Captcha Helper - CodexWorld","og_description":"CodeIgniter CAPTCHA Helper \u2013 Tutorial on how to implement captcha in CodeIgniter. Simple code to create captcha image in CodeIgniter using captcha Helper. Use create_captcha() function to generate captcha code and configure captcha image in CodeIgniter.","og_url":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2016-07-07T17:48:43+00:00","article_modified_time":"2018-05-14T19:51:38+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/07\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"How to Implement Captcha in CodeIgniter using Captcha Helper","datePublished":"2016-07-07T17:48:43+00:00","dateModified":"2018-05-14T19:51:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/"},"wordCount":583,"commentCount":9,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/07\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png","keywords":["Captcha","CodeIgniter"],"articleSection":["CodeIgniter"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/","url":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/","name":"How to Implement Captcha in CodeIgniter using Captcha Helper - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/07\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png","datePublished":"2016-07-07T17:48:43+00:00","dateModified":"2018-05-14T19:51:38+00:00","description":"CodeIgniter CAPTCHA Helper \u2013 Tutorial on how to implement captcha in CodeIgniter. Simple code to create captcha image in CodeIgniter using captcha Helper. Use create_captcha() function to generate captcha code and configure captcha image in CodeIgniter.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/07\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/07\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png","width":1366,"height":768,"caption":"how-to-implement-captcha-in-codeigniter-using-captcha-helper"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/implement-captcha-codeigniter-captcha-helper\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"How to Implement Captcha in CodeIgniter using Captcha Helper"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/07\/how-to-implement-captcha-in-codeigniter-using-captcha-helper.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-r8","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=1682"}],"version-history":[{"count":7,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1682\/revisions"}],"predecessor-version":[{"id":3252,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1682\/revisions\/3252"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/1683"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=1682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=1682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=1682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}