Jump to content

Sessions Value Not Saved


dad00

Recommended Posts

Hi,

 

Im making a login form and im using this code:

if($login=="true"){
$_SESSION['mlvl']=1;
if($username=="admin"){
$_SESSION['admin']=1;
}else{
$_SESSION['admin']=0;
}
}

 

but when the page refreshes their is no value on the sessions i get this output:

Array ( [mlvl] => [admin] => )

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/179672-sessions-value-not-saved/
Share on other sites

When you don't state information that you know concerning the problem in your initial post, like what you just posted (i.e. under what conditions the problem occurs and under what conditions it does not) it takes a really long time for someone to help with what is actually causing your problem because they don't have all the relevant information about the who, what, when, where, and symptoms that are occurring.

 

What does a phpinfo() statement show for the register_globals setting on both your WAMP server and on your live hosting? It your live server has the setting turned ON, then you likely have other post/get/cookie/program variables by the same name as your session variables and they are all overwriting each other. Assuming you don't have any other code that IS dependent on register_globals to work, you should turn off register_globals as soon as possible. They can be turned off in the master php.ini (assuming you have access to it), in a local php.ini (when php is running as a CGI application), or in a .htaccess file (when php is running as an Apache Module.)

 

If the above does not correct the problem, what does a phpinfo() statement show for the output_buffering setting on both your WAMP server and your live host and we would need to see the full code on the page in order to determine what it could be doing to cause the symptoms for the various other possible server specific reasons.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.