Help: Users can login and access their account, but not content?
Hello,
I've created a User System for my website that's not yet released, it allows you to register and login and access the control panel, but the only problem with it is that on user only content it displays "Not Logged in...", but they are logged in, when you go to for example (http://users.domain.com/cp.php) it will display their account data that was previously stored using '$_SESSION' variable.
I don't know if i've done something wrong with defining the $_SESSION['var'] or the php code to display content that is only accessible to registered users:
PHP Code:
<?php
if(isset($_SESSION['uid'])){
echo 'Logged in as '.$_SESSION['s_username'].', <a href="logout.php">logout</a>';
} else {
echo 'Not logged in...';
}
?>
Above is what i use to display hidden content, but it only shows 'Not Logged in...'
And here is the code when the $_SESSION['var'] are defined:
PHP Code:
if($row['activated'] > 0)
{
$_SESSION['s_logged_n'] = 'true';
$_SESSION['uid'] = $row['uid'];
$_SESSION['loggedon'] = $row['lastsigned'];
$_SESSION['lastupdate'] = $row['lastupdate'];
$_SESSION['s_pass'] = md5($row['password']);
$_SESSION['s_username'] = $username;
Well that's half of the code, i would appreciate if anyone could help me fix this problem!
Regards,
Ben