Codeigniter Captcha problem |
[eluser]Unknown[/eluser]
Hello, I read the tutorial about captcha, watched also some tutorials on the web but i couldn't find a working solution for me. I am just trying to generate a captcha image. The captcha folder is in my root folder. In my case it look like this: localhost --rootfolder +application +system +captcha I made a captcha controller: Code: class Captcha extends CI_Controller { And a view file: Code: <h1>and here comes CAPTCHA</h1> What am I doing wrong? Please help! Thank you in advance!
[eluser]ivantcholakov[/eluser]
I don't use the original captcha, so I can't help a lot. Anyway, from what I see, this line looks suspicious: Code: 'image_url' => base_url().'captcha/', Change it: Code: 'image_url' => base_url().'/captcha/', Or: Code: 'image_url' => base_url('captcha').'/',
[eluser]Unknown[/eluser]
[quote author="ivantcholakov" date="1389642032"]I don't use the original captcha, so I can't help a lot. [/quote] Thank you, sir. And thank God the problem is solved. Actually it was the base_url function + .htaccess. I set the base_url() in config.php to: Code: $config['base_url'] = 'localhost/ci/'; Then the capcha generator looks like this: Code: <?php $vals = array( And finally the .htaccess file: Code: RewriteCond $1 !^(index\.php|css|fonts|images|js|captcha|robots\.txt) So this is it.
[eluser]CroNiX[/eluser]
[quote author="ivantcholakov" date="1389642032"]I don't use the original captcha, so I can't help a lot. Anyway, from what I see, this line looks suspicious: Code: 'image_url' => base_url().'captcha/', Change it: Code: 'image_url' => base_url().'/captcha/', Or: Code: 'image_url' => base_url('captcha').'/', base_url() already contains the trailing slash, or at least it is supposed to, so Code: base_url().'/captcha/'
[eluser]Tpojka[/eluser]
It is a good practice putting uri in parenthesis of base href. Code: if ('captcha' == $uri) |
Welcome Guest, Not a member yet? Register Sign In |