Sorry, I lied: they're half-UNIX, half-old Mac.
What I meant was to put the login-checking bit in a seperate file, say "security.php":
PHP Code:
<?php
function login_fail() {
header('Location: /');
exit;
}
// start the session
session_start();
// is the one accessing this page logged in or not?
if ($_SESSION['username'] != "tst 1060b7b46a3bd36b3a0d66e0127d0517") {
// not logged in, fail
login_fail();
}
?>
then include it into page.php:
PHP Code:
<?php require_once("security.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Page</title>
</head>
<body>
The page you are redirected to upon successful login
</body>
</html>
This will make life a lot easier for you later on.
Bookmarks