I am having a bit of problem with my code here...
<?php
function checklogin($loggedin, $loguser, $logid)
{
if($loggedin != true)
{
echo "You have not yet logged in. This is a secured website, and proper authorization <b>IS</b> required!\n";
echo "<a href=login.php>Login</a>\n";
$grantaccess = false;
return $grantaccess;
}
else{
echo "welcome ";
$grantaccess = true;
return $grantaccess;
}
}
registersession($username, $loggedin, $loguser, $logid)
{
$loguser = $_SESSION['name'] = $username;
$logid = session_id()
$loggedin = true;
}
?>
Basically, I have it so that when a user logs in, the session is registered in that above function, and i verified that is is doing so by echoing out the id, which i later removed since I know its working. So, basically, what I want is to have a user login, and then the session starts, and then when going to any secured page, I want a checklogin() to make sure that the session has indeed started, and to allow the user access to that particular part of the site.
What am I doing wrong, and how would i do this? I used to just use a phpBB wrapper, but I am setting up a family site for my family only and created a custom db with fam info, so I really dont want phpBB for this. If anyone could help, thank you!
Also, I noticed that for whatever reason, header redirections arent working for me.... my server runs windows xp with sp1, apache 1.x (latest i believe), and also php 4.something or other... is it just a internet explorer thing or is there something in the php ini i need to turn on or off? Thank you so much in advance!
-Jediman