Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to create captcha in codeigniter 2.1.0
    text
    copied!<p>How to create captcha in codeigniter 2.1.0 load helper codeigniter ? when i have model m_captcha :</p> <pre><code> function __construct() { parent::__construct(); } function setCaptcha() { $this-&gt;load-&gt;helper('captcha'); $vals = array( 'img_path' =&gt; './asset/captcha', 'img_url' =&gt; base_url().'/asset/captcha', 'expiration' =&gt; 3600,// one hour 'font_path' =&gt; './system/fonts/georgia.ttf', 'img_width' =&gt; '140', 'img_height' =&gt; 30, 'word' =&gt; random_string('numeric', 6), ); $cap = create_captcha($vals); if ($cap) { $capdb = array( 'captcha_id' =&gt; '', 'captcha_time' =&gt; $cap['time'], 'ip_address' =&gt; $this-&gt;CI-&gt;input-&gt;ip_address(), 'word' =&gt; $cap['word'] ); $query = $this-&gt;db-&gt;insert_string('captcha', $capdb); $this-&gt;db-&gt;query($query); }else { return "Captcha not work" ; } return $cap['image'] ; } </code></pre> <p>and i have controller c_login :</p> <pre><code> function __construct() { parent::__construct(); $this-&gt;load-&gt;model('m_captcha'); } public function index() { $this-&gt;load-&gt;helper('captcha'); $data = $this-&gt;m_captcha-&gt;setCaptcha(); $this-&gt;load-&gt;view('login/v_form',$data); } </code></pre> <p>and i have view :</p> <pre><code>&lt;?php echo form_open('c_login'); ?&gt; &lt;?php echo $cap['image']; ?&gt; &lt;?php echo form_error('captcha');?&gt; &lt;?php echo form_close(); ?&gt; </code></pre> <p>why the captcha cannot show in view ? position folder and image captcha in sms/asset/captcha . sms is folder root Codeigniter.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload