简体   繁体   中英

Session_Start or PHP Requests Doesn't Work

Wit the code below I'm always automatically logged out from my system.. If I remove all classes includes session works very well..

I'm not sure where the problem is ..... session_start or bad PHP requests ?? Any suggestion? Thanks!

Update: Ah... I just remove updateUserSession from my code and works fine now

  1. Be sure that $_SESSION['user_name'] and $_SESSION['user_id'] contain valid values.
  2. I think this part of code is wrong: if($_SESSION['user_id']==1) and must be if(!empty($_SESSION['user_id']))

About the second point, your current code is verifying that user_id is 1, instead with my replacement PHP verifies that $_SESSION['user_id'] is NOT empty.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM