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?
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?
Browser other questions tagged php web-application session
You are not signed in. Login or sign up in order to post.
You are using
session_start();
on all pages?– Valdeir Psr
Yes. I’m even using if (!isset($_SESSION)){ session_start(); }
– Lucas Fonseca
$_SESSION['logado'] = 'S';
. Also check if you are not callingsession_destroy
– Valdeir Psr
In localhost it worked normally, when I went up to the web server that problems appeared.
– Lucas Fonseca
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.– Bacco
It was just a misspelling.. I’ll post it here for you to see.
– Lucas Fonseca
Try to set the stored path using
session_save_path
; Make sure you are not usingsession_destroy
in some other file; check in the browser if cookies are being generated with the session ID. (Usually it isPHPSESSID
).– Valdeir Psr
How do I do these steps? Can you help me?
– Lucas Fonseca
The browser is generating PHPSESSID, and just remembering that on localhost it works normally
– Lucas Fonseca
What type of server?
– Mauricio Wanderley Martins