Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.