2017-10-15 10:49
浏览 336


This may seem pretty confusing at first but I have a log in system on my website. I also have a forum on my website. What I want to do is make it so if people click on the forum button and they aren't logged in, it takes them to the login page, but if they are, it will take them to the forums. I have that in place but I am trying to do one more thing. I also want to make it so if people go in the url and type, it will check if they are logged in and if they aren't, take them back to the login page and if they are, proceed to take them there. I tried with this but it only works for the first part like I stated, not the rest.

<!-- Main Content -->
        <p class="japanese">プレーンズ</p>
        <p class="dev" contenteditable>currently under development</p>
        <p class="clock"></p>
        <p class="login"><a href="login.php">login</a></p>
        <p class="register"><a href="register.php">register</a></p>
            if (isset($_SESSION['u_username'])) {
                echo '<p class="forums"><a href="forums.php">forums</a></p>';
            } else {
                echo '<p class="forums"><a href="login.php">forums</a></p>';

图片转代码服务由CSDN问答提供 功能建议

一开始这看起来很混乱,但我的网站上有一个登录系统。 我的网站上也有一个论坛。 我想要做的就是这样做,如果人们点击论坛按钮并且他们没有登录,则会将他们带到登录页面,但如果是,则会将他们带到论坛。 我有这个,但我想再做一件事。 我也想这样做,如果人们进入网址并输入,它会检查他们是否已登录,如果不是,请将他们带回登录页面,如果他们 是的,继续把它们带到那里。 我试过这个,但它只适用于我说的第一部分,而不是其余部分。

 &lt;! - 主要内容 - &gt; 
&lt; p  class =“japanese”&gt;プレーンズ&lt; / p&gt; 
&lt; p class =“dev”contenteditable&gt;目前正在开发中&lt; / p&gt; 
&lt; p class =“clock”&gt;&lt; / p&gt; \  n&lt; p class =“login”&gt;&lt; a href =“login.php”&gt;登录&lt; / a&gt;&lt; / p&gt; 
&lt; p class =“register”&gt;&lt; a href =  “register.php”&gt;注册&lt; / a&gt;&lt; / p&gt; 
 if(isset($ _ SESSION ['u_username'])){
 echo'&lt; p class =“forums  “&gt;&lt; a href =”forums.php“&gt;论坛&lt; / a&gt;&lt; / p&gt;'; 
 echo'&lt; p class =”forums“&gt;&lt; a href  =“login.php”&gt;论坛&lt; / a&gt;&lt; / p&gt;'; 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题