oK, since my original question didn't make sense to the majority, I will explain in details. I have a membership system I made through some tutorials based on codeigniter framework. on my main page I have 3 buttons containing login, register, forgot pass, respectively. when I test the login and enter my details as a user, I still can see the login button, which makes no sense because it should be hidden in case I logged in. The same thing for other features I mentioned above.
now I was trying some way like if($_SESSION['user'] == "")
{
to achieve my goal, but without any success.
any idea how to do this correctly?
Thanks
<div id='nav'>
<?php
if(is_logged_in())
{
if(is_admin())
{
echo anchor('admin','Admin Dashboard');
}
echo anchor('user/logout','Logout');
echo anchor('users/profile','Profile' . ' [' . $_SESSION['user_name'] . ']');
}
else
{
echo anchor('user/login','Login');
echo anchor('user/signup','Signup');
}
echo ' ' . anchor(base_url(),'Home');
?>
</div>
If you use sessions for being logged in
if( !isset($_SESSION) ){
//echo links
}
make sure to unset() all your $_SESSION vars on logout
I don't understand the question, because if you wrote the login system or can know when a user is logged in programmatically... there really should be no question. You can either load different views from the controller based on this "logged in" variable, or pass the variable to your view that is basically $displayLogin... if that is true, display the login information, if not, don't.
Would need to know more about your setup to provide more useful information obviously.