php / mysql - Issue when redirecting based on user_level

前端 未结 1 680
礼貌的吻别
礼貌的吻别 2021-01-28 21:26

I\'m currently building a control panel based on user_level. If a user has level (0) they can\'t access anything besides the index page, level (1) can access everything.

相关标签:
1条回答
  • 2021-01-28 22:14

    You are using session like:

    if($_SESSION["user_level"] == 0)
    {
        header('Location: index.php');
    }
    

    but session is not started here. Start the session on first line like:

    session_start();
    

    only after that you can access the session variable.

    0 讨论(0)
提交回复
热议问题