For my website user tracking is implemented in which login duration of user is stored in database. I am using time() to get current time. So,
$login_time = time (); // when user logs in
$logout_time = time (); // when user logs out
$duration = $logout_time - $login_time; // duration of login
But , what to do if your does not to logout ? What will be the right value to store in database? I am using PHP, Codeigniter and MySql.