PHP - Log in Script Not Creating Sessions

后端 未结 3 2042
醉酒成梦
醉酒成梦 2021-01-26 13:04

I have a log in script where I have been able to successfully make users, and log in. Now my issue is that whenever I try to use my method of protecting pages, being seeing if t

相关标签:
3条回答
  • 2021-01-26 13:13

    You need to put session_start(); on every page you want to use the session.

    0 讨论(0)
  • 2021-01-26 13:15

    You have session_start(); after $_SESSION['user'] = $row; Actually you have it after a die(); command. Nothing happens after that.

    Put session_start(); at the top of PHP in every page (pref common.php since you have one) not just one page.

    0 讨论(0)
  • 2021-01-26 13:19

    It would be better to set the session_start() on top

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