This can be done using cookies, but most PHP sites use sessions.
. : http://www.php.net/manual/en/session.examples.basic.php
:
1.) , , , .
signin.php(sudo-code)
session_start();
if(username is correct && password is correct)
{
$_SESSION['userkey'] = GUID from database
}
2.) PHP , .
signincheck.php(sudo-code)
session_start();
$is_signed_in = false;
if (isset($_SESSION['userkey']))
{
if(isvalid userkey)
{
$is_signed_in = true;
}
}
3.) , .
require('signincheck.php');
if($is_signed_in === true)
{
allow access to page
}
else
{
header redirect to some other page
}