Hey, some of us have other things to do; we can't be hitting on the site every two hours, you know ... 🙂
First of all; ditch the session_register('login_status') etc., and instead of using $login_status, use $_SESSION['login_status']. A bit better performance (apparently), easier to read (I find), simpler to use (less mucking around), and less confusing (I've noticed).
That said: on each page where you will be using sessioned data (reading it or writing it), start off with the line
<?php
session_start();
?>
(You can actually fiddle with php.ini to do that automatically for every page, but that's usually overkill.)
Then any time you want to use such data (read it to see if whoever is hitting the page is logged in, write it to log them in, or whatever), look at the appropriate element of the $_SESSION[] array. E.g.,
if(isset($_SESSION['login_status']) && $_SESSION['login_status']=='logged')
{ // they're logged in
}
else
{ // they're not.
}
$SESSION[] works pretty much like any other array. The differences are:
You don't need to declare it global inside functions;
due to a bug in PHP (fixed in 4.3???), unset($_SESSION['thingy']) doesn't work right - use $SESSION['thingy']=null instead; and
when the script ends, the contents of the $_SESSION array is written to the session file - ready for the next time the session is started.
As for whether you need them or not. Well you need some method for tracking a user from page to page, so that you can recognise them when they come back. http doesn't know one user from another - it just sees individual request/response transactions. It was for this purpose that session variables were invented, so one might as well use them.
What happens (thumbnail sketch follows; see the manual or do a search for more detail), when you call session_start() is that PHP looks to see if there was a sessionID in the header of the request that it's handling.
If there was, it gets the session data it has stored under that ID and uses it to populate the $_SESSION[] array.
If the sessionID was missing, it creates a new set of data under that ID, and the $_SESSION[] array is initially empty.
PHP also sticks a header into its response back to the browser that basically says "whenever you make a request to this site, stick this in the header so I can recognise you". "This" being of course the sessionID.