PHP session seemingly not working -


Session variable is not working for me apparently; I do not know what I'm doing wrong is this code I'm checking for valid passwords for:

  if ($ input_password_hash == $ password_hash) {session_start (); $ _SESSION ['is_user'] = 1; Header ("Location: .. / new_look"); // or location: index.php} The second echo "wrong password.";  

In the index.php file (where it redirects), I have this code:

  if ($ _SESSION ['is_user'] = = 1) {// show index page with the navigation bar for the registered user} else {// anything else}  

but it is not working at all.

The session starts apparently and can be verified by checking the cookie.

What am I doing?

You know that you have session_start () You must write before using the code> $ _ session variable, right? It seems that you have not placed it anywhere in index.php.


Comments