在login-php上重定向到不同的页面

时间:2017-12-12 08:05:24

标签: php mysql session

我想将管理员重定向到页面,将其他用户重定向到其他页面。 能够在程序中而不是在oop中。 管理员可能会添加新用户并显示他们n有很多工作要做,而用户只能看到他/她的页面。

editText  = (EditText)findViewById(R.id.editText);

寻找解决方案....请帮助。 *查看代码中的代码段。

2 个答案:

答案 0 :(得分:1)

这样做的一个简单方法是定义角色。

例如

if($_SESSION['username'] == 'admin@admin.com' && $_POST['role'] = 'admin'){
       header("location:admin.php");
 } 
 else {

 header("location:profile.php");
}

答案 1 :(得分:0)

检查以下代码,希望这有帮助。

if($_SESSION['status'] == 'error') {
     header("Location: index.php");
   } 
   else {

    if($_SESSION['username'] == 'admin@admin.com') {
     header("Location: admin.php");
   } 
   else {

     header("Location: profile.php");

   }

}