Link to home
Start Free TrialLog in
Avatar of maeve100
maeve100

asked on

What does "$_SESSION['index.php']" mean?

Hello,

I have a bit of code I am trying to modify, and it references page names as sessions all over the place.  Take for example:
if ($_SESSION['index.php'] != '') {
.. }

I try to print the session to the screen so I can see it, but using echo, print, print_r doesn't display anything.  In general use what do these sessions store? How can I print its contents?

Thanks, Liz
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

That's a 'session variable'.  http://www.php.net/manual/en/reserved.variables.session.php  They can be used like 'regular' variables except that they are preserved on the server so they can be set and retrieved from different pages.  If it doesn't display anything it doesn't contain anything... in Your session.  Session variables are available only to the session that created them.  Without looking at the files on the server, you can't see someone else's session variables.
Avatar of maeve100
maeve100

ASKER

Sorry, should have been more clear - I understand that its a session variable - but what is the significance of the index.php?  I see a bunch that reference page names in the files.  Is there something special to that? Or is it just a variable name that happens to match a page name that is being used?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you echo it out so you can see what value it is holding? Is this in a CMS, so it is holding which template to use or something?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to echo it at several points throughout the web-application to see exactly what it is being used for. Kind of looks like the session variable is for tracking site usage or something.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thats what I get for having multiple coders passing on a jumble of a project to a low level front end coder, hehe.  Thanks for helping me understand!