I have a complete login system in PHP using Sessions, which works like this
<?php
if(isset($_SESSION['user_id']))
{
//lets the user use their profile
}
else
{
//takes the user to the login page
}
?>
It works fine on my local server (XAMPP) as doesn't logout the user. Which means the session wasn't destroyed. But when I use the same system on a live server which is a Linux(Ubuntu) server, it destroys the session when I close the browser. I've tried extending the session lifetime but it doesn't work. I know this is how Sessions are supposed to work.
But, want to keep users logged in like on Facebook(on a mobile browser). I know I can use cookies for that but, cookies shouldn't be used to save information like user name and password.
What should I do? any suggestions.