Assuming your "persistent login function" is just automatically logging in users who have a cookie/session, CodeIgniter's session library will handle this for you.
If you auto-load the session library, CI will update the session on each page load.
In order to check the sessions on pageload, you can put the check in the controller constructor, on the controller methods, or you can create an extended controller to do it for you across the board -- this would probably be the easiest and make the most sense.
application/core/MY_Controller.php
class MY_Controller extends CI_Controller{
public function __construct() {
parent::__construct();
if($this->session->userdata('session_id') == FALSE) {
redirect('/login');
}
}
}
Controllers:
auth required:
application/controllers/Whatever.php
class Whatever extends MY_Controller {
// have to be logged in to see anything in here
}
auth not required:
application/controllers/Login.php
class Login extends CI_Controller{
// don't have to be logged in to see stuff here since
// we're extending CI_Controller and not MY_Controller
}