it's also meant to show a link to the logout page but it doesn't - it shows the the text in link format but ther'e no link. i've echoed out the session variables assigned to the user name so you can see that the sesh vars are ok:
Code: Select all
function check_login()
{
//add logout link if user logged in
if (isset($_SESSION['valid_pa_mbr']) || isset($_SESSION['valid_ba_mbr']) ) {
echo "<a href='logout.php' id='logout-msg' >Log out</a>";
}
if ( $_SERVER['PHP_SELF'] == '/~unn_p921847/t1/index.php' ) {
return;
}
echo 'tgtgttg ' . $_SESSION['valid_pa_mbr'];
echo 'kukukuk ' . $_SESSION['valid_ba_mbr'];
//redirect to login page if no log in session
if (!isset($_SESSION['valid_pa_mbr']) || !isset($_SESSION['valid_ba_mbr']) ) {
$url = "login.php";
header ("Location: $url");
}http://www.nl-webspace.co.uk/~unn_p921847/t2/login.php
now here's the same example with the condition swithched so that if the user is logged in it redirects and if he isn't logged in he can roam around only this way the damn thing works as it should:
Code: Select all
if (!isset($_SESSION['valid_pa_mbr']) || !isset($_SESSION['valid_ba_mbr']) ) {Code: Select all
if (isset($_SESSION['valid_pa_mbr']) || isset($_SESSION['valid_ba_mbr']) ) {please somone explain before i go mad!