Where are session variables stored

Hi all,

I am going through a website that another user built and there is an error with a session variable. I loosely know how sessions work, but I am no expert. I am wondering where these variables are stored (in a specific file?) so I can access the variable and take a look at what the problem is.

  • Michael

bump

First off, Please don’t bump.

Secondly I am unsure of what you mean by where are session variables stored?

I would recommend you look at http://www.php.net - This is the manual to php and should be your bible. It appears you either don’t understand php or you are simply asking the question incorrectly.

Sorry about the bump.
I’m new here and it is usually acceptable at other forums.

As for my question, I am currently altering someone else’s code and they have a lot of references to session variables

i.e. $hello = $_SESSION[‘table’][‘values’][‘hello’]

I am wondering where this session vairable is instatiated whether in a seperate file that is used to create all session variables or whether it will be someone in the person’s code?

  • Michael

Ok, sorry if I am misunderstanding what you are asking, don’t worry, its probably more me than you as I am a very visual learner. Which makes understanding what someone is asking about hard!

Here is what happens with sessions:

Page1.php - Set session variables -

[php]
session_start();
$_SESSION[‘auth’] = true;
[/php]

Page2.php - Call Session variables -

[php]
session_start();
$auth = $_SESSION[‘auth’];

echo $auth; //OUTPUTS: true;
[/php]

So if I understand your question correct I believe the answer would be the session variables are set on one of the pages in the site.

HTH! :)

Thanks for your help,

It’s going to be a long process finding exactly where the session variable was instantiated, but at least I know where to look.

  • Michael

The PHP Manual:

session.save_path defines the argument which is passed to the save handler. If you choose the default files handler, this is the path where the files are created. Defaults to /tmp. See also session_save_path().

Sounds pretty unambiguous to me :slight_smile:

Hey guys,
I finally found where the session variable was instatiated it and fixed the problem.
Thanks for your help,

  • Michael
Sponsor our Newsletter | Privacy Policy | Terms of Service