Session in PHP resetting?

Asked

Viewed 64 times

0

I’m setting up a system and when the person logs in creates the sessions normally, example:

$_Session['logado'] = 'S'; 

But when I redirect to the main page, the session is simply reset and empty, "worthless".

What can it be?

Login.php

Checar_data.php

Index.php

  • You are using session_start(); on all pages?

  • Yes. I’m even using if (!isset($_SESSION)){ session_start(); }

  • $_SESSION['logado'] = 'S'; . Also check if you are not calling session_destroy

  • In localhost it worked normally, when I went up to the web server that problems appeared.

  • I hope it’s just a typo here on the site, but the spelling is $_SESSION and not $_Session. Anyway, you need to post more code, preferably one [mcve], because just for what’s in the question, you can only try to kick answers. Seeing the original code (or one that generates the same problem) may be able to diagnose.

  • It was just a misspelling.. I’ll post it here for you to see.

  • Try to set the stored path using session_save_path; Make sure you are not using session_destroy in some other file; check in the browser if cookies are being generated with the session ID. (Usually it is PHPSESSID).

  • How do I do these steps? Can you help me?

  • The browser is generating PHPSESSID, and just remembering that on localhost it works normally

  • What type of server?

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.