You can accompish this by registering your logged-in users in a cookie or the session array and redirecting anyone who is not registered in there. The most basic approach to this is:
- start each of your scripts with the PHP session_start() command
when the user has logged in successfully, register his name in the $_SESSION array, e.g.
[php]$_SESSION['username']=$user;[/php]
- at each page, check if the user is registered by checking the $_SESSION array, if not, redirect the user to the login script:
[php]if (!isset($_SESSION['username']))
header('Location: logon.php');
else
.. continue processing ..[/php]
A more complete and indepth tutorial on this subject can be found at
The First Session.
Ronald :cool: