It can be done with Cookies but most PHP sites use Sessions.
See for detailed information: http://www.php.net/manual/en/session.examples.basic.php
The steps involved:
1.) Create a sign-in page that checks for valid username and password then save a key value to a session variable that references the user table.
signin.php (sudo-code)
session_start();
if(username is correct && password is correct)
{
$_SESSION['userkey'] = GUID from database
}
2.) Create a PHP page that has the session variable and checks if the variable is set.
signincheck.php (sudo-code)
session_start();
$is_signed_in = false;
if (isset($_SESSION['userkey']))
{
if(isvalid userkey)
{
$is_signed_in = true;
}
}
3.) Require that page in each of your pages that needs to be for registered only.
require('signincheck.php');
if($is_signed_in === true)
{
allow access to page
}
else
{
header redirect to some other page
}