When using CI routes, I have the default route which points somewhere, but I want it to point to another place if the user is logged in.
Whats the best way of doing this?
开发者_如何学GoEdit
I don't think I wrote this question as clearly as I should have. What I mean is that if the user is not logged in and they go to www.domain.com/
they go to the home page. If they are logged in and they go to the same URL they see a different page, but the same URL in the address bar
Basically as Malachi said, one way to do this is:
class MY_Controller extends Controller {
function __construct()
{
if($this->auth_library->is_logged_in())
{
redirect('my_logged_in_page');
}
// else...redirect to login?
}
}
// call it...
class some_controller extends MY_Controller {
// etc
}
精彩评论