IF they are authorised by matching a username and password from a mysql database, set a cookie like this :-
$sql = "SELECT id
FROM $table_name
WHERE username = \"$username\" AND password = password(\"$password\")
";
$result = mysql_query($sql)
or die ("Can't execute query.");
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$num = mysql_numrows($result);
if ($num != 0) {
$cookie_name = "auth";
$cookie_value = "ok";
$cookie_expire = "";
$cookie_domain = "";
etc, etc
Then at the top of every protected page, enter this sort of code :-
if ($auth == "ok") {
Code to display, or variables set and then use the normal HTML code at the end.
} else {
header ( "Location:http://yourlogin page");
EXIT;
}
It works for me. Youmay want to encrpy the cookie names and values tho for more security.
Laterz
Jules@hungrybear.co.uk