Reputation: 825
I want to use Tank auth in my CodeIgniter project, but there is need to start with basic installation of Botdetect captcha in CodeIgniter.
I have followed the Quickstart Installation guide on this link.
The view upon which I am trying to run this provision is saved under application/views/welcome_message.php, which is here below:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<link type="text/css" rel="Stylesheet" href="<?php echo CaptchaUrls::LayoutStylesheetUrl() ?>" />
</head>
<body>
<?php echo $captchaHtml; ?>
<input type="text" name="CaptchaCode" id="CaptchaCode" value="" />
</body>
</html>
And the corresponding Controller is saved under application/controllers/Welcome.php, also here below:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function __construct(){
parent::__construct();
}
public function index() // Your controller
{
// load the BotDetect Captcha library and set its parameter
$this->load->library('botdetect/BotDetectCaptcha', array(
'captchaConfig' => 'ExampleCaptcha'
));
// make Captcha Html accessible to View code
$data['captchaHtml'] = $this->botdetectcaptcha->Html();
$this->load->view('welcome_message',$data);
}
}
When run on my browser this is what I received:
I understand the BotDetect is using session and I have managed to fix the required configurations and sessions are being created in "ci_sessions" on each run.
How can I solve this problem to load BotDetect Captcha.
Upvotes: 1
Views: 519
Reputation: 143
It looks like you forgot to register BotDetect Captcha route used for BotDetect Captcha requests (Captcha images, sounds, resources, etc.) in "application/config/routes.php" file.
Please check the following 2 points:
1 - make sure that you have registered BotDetect Captcha route in your "routes.php" file
$route['botdetect/captcha-handler'] = 'botdetect/captcha_handler/index';
2 - in your "controllers" folder needs to have "/controllers/botdetect/Captcha_handler.php" file
I hope this helps.
Upvotes: 1