用户登录时隐藏注册和登录按钮? [英] Hide registration and login buttons when a user logged in?
问题描述
现在我正在尝试某种方式像 if($ _ SESSION ['user'] ==)
实现我的目标,但没有任何成功。
{
任何想法如何正确地做?
感谢
< 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'。'& nbsp; ['。$ _SESSION ['user_name']。']');
}
else
{
echo anchor('user / login','Login');
echo anchor('user / signup','Signup');
}
echo'& nbsp;'。 anchor(base_url(),'Home');
?>
< / div>
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>
这篇关于用户登录时隐藏注册和登录按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!