I have very simple login script that would give user access for advanced functions of the page. Now .. loggin in seems to work fine .. and logout seem to work fine. I get mane appear after user is looged in .. and all is great ... but when i clink on any link on the menu my user is logged out and i no longer see user menu. Please bare with me on this one as i am not a pro .. just amateur
This is where credentials are being checked using mysal db
This includes both login and logout options .. as you can see
Code: Select all
<?
$_SESSION['login'] = $login;
$_SESSION['security_id'] = $security_id;
$_SESSION['uid'] = $uid;
if (isset($login) && isset($password))
{
include('connect.php');
$query = "SELECT * FROM sec_auth WHERE login='$login' and pass='$password' and enabled='1'";
$result = mysql_query( $query, $link );
if (mysql_num_rows($result) >0)
{
$valid_user = $login;
session_register('valid_user');
}
}
if($user == 'logout')
{
session_start();
$old_user = $valid_user;
$result = session_unregister("valid_user");
$msg = "<table width='100%' align='center' cellpadding='2' cellspacing='2'><tr><td height='18' align='center'>Zostales wylogowany ze strony administracyjnej.</td></tr></table><br>";
echo "<meta http-equiv=\"refresh\" content=\"3;URL=?page=\" />";
session_destroy();
}
?>Code: Select all
<?
if (session_is_registered("valid_user"))
{
?>
<table width="100" border="0" cellpadding="0" cellspacing="0" class="frameboxmaincat">
<tr>
<td>Twoje Konto</td>
</tr>
</table>
<table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="frameboxcat">
<? echo "You are logged in as $valid_user"; ?>
</td>
</tr>
</table>
<?
}
?>Code: Select all
?page=123456789It would seem that my variable valid_user is not being kept alive after i click on the link in the menu.
Can anyone help me see what i am missing.
Thank you .
Best regards,
Greg