I am working on setting up member's pages for a non-profit organization. Each member will have access to a user's admin login area where they can input their individual data into MySQL via PHP. They will then have a folder on the website where we can give other members useful information about them.
Here's what I have so far.
<?php
session_start(); // Start Session
header("Cache-control: private"); //IE 6 Fix
include "../members/db.php";
$sql = 'SELECT username , first_name , last_name ';
$sql .= 'FROM sites ';
$sql .= 'WHERE 1 AND username = \'user1\' LIMIT 0, 30';
// Register some session variables!
session_register('username');
$_SESSION['username'] = $username;
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
?>
<html>
<head>
<title><? echo $username ?></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<? echo "This is a test for $first_name, $last_name"?>
</body>
</html>
The variables in the <body> is correct if the user is still logged in, but empty if the user is not.