Alright...I'll try to simplify this so let's assume a user is already in the database. There is the page where they log in. That get's posted to another page that checks their info against the database and if it passes it registers the session variables like this:
$_SESSION["userid"] = $userid;
$_SESSION["passwd"] = $passwd;
then it prints a link to the forum which happens to be named index.php which checks to see if the session is registered. I'll giv you the beginning of index.php and the function
<?php
session_start();
require( './functions.php');
checksession($_SESSION["userid"]);
showheader("noiseusse bored");
?>
here's the checksession() function from functions.php:
<?php
function checksession($anyuser)
{
if ($anyuser == "")
{
showheader("error");
?>
<html>
<head>
<center>
you must <a href="home.php">login</a> in order to be here.
</center>
<?php
showfooter();
exit();
}
}
That works fine, the session variable remains but on any subsequent page, like if I wanted to view the posts, the session variable doesn't go. I'm calling the checksession() function on every page to prevent people from seeing anythig if they aren't logged in.
So, just to make it extra clear: After getting to the index.php page without a problem I want to view posts. I click on a topic id and it takes me to view.php which looks like this:
<?php
session_start();
require( './functions.php3');
checksession($_SESSION["userid"]);
viewpost($topicID);
?>
At that point the session variable is empty and so my error checking tells me I need to log in.
I hope that was clear enough, thanx for all your help