I\'ve seen plenty of questions here about my topic but it seems I still haven\'t found my answer. What I\'m actually looking for is when the session expires the user will be aut
You can check user's session by making the ajax
call and wrap it into the setInterval
jquery's
function like
setInterval(function() {
// Do something every 1 minute
$.ajax({
type : 'POST',
url : ''
success : function(data){
if(data){
//your session is not expired
}else{
//your session is already expired
window.location.href="your url"; // or you can redirect from here also
}
});
}, 60000);
//This function checks your session
function check_session(){
$id = $this->session->userdata('id');
if($id ){
echo 1;
}else{
echo 0;
redirect('your register controller');//redirect from here or you can redirect in the ajax response
}
die();
}
Hope it makes sense