[eluser]webnology[/eluser]
Hi all,
I've upgraded everything, now running CI2 and Tank_Auth instead of dx_aut. I have exactly the same issue. I can login, but when I go to one of my own controllers, I get logged out. If I use the welcome message, which is delivered with Tank_auth, it works fine.
This is the Tank_auth code, which works:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->library('tank_auth');
}
function index()
{
if (!$this->tank_auth->is_logged_in()) {
redirect('/auth/login/');
} else {
$data['user_id'] = $this->tank_auth->get_user_id();
$data['username'] = $this->tank_auth->get_username();
$this->load->view('welcome', $data);
}
}
}
This is the my code, which doesn't work:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Form extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->library('tank_auth');
}
function addCustomer()
{
if (!$this->tank_auth->is_logged_in()) {
redirect('http://www.amazon.com/');
} else {
redirect('http://www.google.be/');
}
}
}
If I go directly to the url (typing it, instead of clicking), I stay logged in.
As far as I can see, there is no difference in the code. Any ideas someone?
Many thanks,
Michel