title: How to exec a function when codeigniter session expires
body: <p>I got an users table on my database with a "Online" field, it gets the value "1" when the user loggin, and changes to 0 when the user logout. The problem is that if the user close the tab and don't click on the "Logout" button he stays Online forever.</p>
  
  <p>So I would like to hook some kind of function so when the session expires it changes the value of this "Online" field - on the database - to "0".</p>
  
  <p>I'm open to suggestions of course, because I don't what is the right approach for this. </p>