Foa*_*dia 0 php redirect login restrict
我在我的移动网站上有一个登录页面作为index.html,因此用户必须登录,将他们带到主站点,或注册,这将让他们注册,然后登录并获得访问主站点.
有点像移动应用程序登录页面.
如何在用户登录后阻止该页面再次被访问?因为他们只需按下手机上的后退按钮即可返回此页面.
理想情况下,如果他们登录后尝试访问此index.php页面以重定向回home.php页面,我想要.
在这里开始工作 - http://m.cutecupcak.es
小智 5
使用会话或cookie.
您可以在登录时设置会话,如果会话已设置,则检查index.php页面.
会话的基本用法
<?php
session_start();
// Set the session
$_SESSION["loggedin"] = "yes";
// Check if the session exists or doesn't, in this case, it does.
isset($_SESSION['loggedin']){
echo "You're logged in";
}else{
echo "You're not logged in";
}
?>
Run Code Online (Sandbox Code Playgroud)