danfreak - 07 December 2006 09:45 AM
I installed Auth,
but I get this error message:
Fatal error: Cannot redeclare class db_session in C:\www\CI\system\application\libraries\Db_session.php on line 16
PS: I also added a bit of stuff in the Auth wiki
I solved the problem:
In your system/application/config/autoload.php change
$autoload['libraries'] = array('database', 'db_session', 'authlib');
to
$autoload['libraries'] = array('database', 'authlib');
This unloads db_session, that get’s already loaded in system/application/libraries/Authlib.php
My test controller (welcome.php) to see it in action
class Welcome extends Controller {
function __construct(){
parent::Controller();
}
function index()
{
if ($this->authlib->isValidUser())
{
$user=getUserName();
$logout_link=anchor('auth/logout', 'logout');
echo "welcome <b>".$user."</b> / ".$logout_link."<BR />";
$this->load->view('welcome_message');
}
else
{
echo "not logged";
redirect('/auth/login', 'refresh');
}
}
}
?>
When I try to register as a new user the page http://localhost/your_CI/index.php/auth/register
returns the following error:
Fatal error: Call to undefined method CI_Loader::setdata() in C:\www\CI\system\application\controllers\auth.php on line 159
that correspondends to the following call
function register_index()
{
$countries = null;
if ($this->config->item('auth_use_country'))
$countries = $this->Usermodel->getCountries();
if ($this->config->item('auth_use_security_code'))
$this->authlib->register_init();
$data['countries'] = $this->Usermodel->getCountries();
$this->load->setdata($data);
$this->load->view($this->config->item('auth_register_view'));
}