Hi,
To ensure they are logged in, you'd need to store their session ID right after they log in so that you can compare with that ID everytime they load a new page.
use mysql to store the session ID and have a field indicating they are logged in and what username they are logged in as.
in you PHP, after you call session_start, compare the session_id() with the one in the database to verify that this session has been logged in. If not, then redirect to the login page.
You can also add a time field in the mysql table and in your SQL query, add something like:
$SQLQuery = "SELECT ... WHERE lastactivity > " . (time() + 600);
Make sure you update the table everytime they go to a page:
$SQLQuery = "UPDATE table SET lastactivity = " . time() . " WHERE session_id = '" . session_id() . "'";
Note: the above codes are just abstract. Create your table and replace the field names with the ones you assigned.
-sridhar