Session Variables not working.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Subaru
Forum Newbie
Posts: 2
Joined: Wed Oct 12, 2005 8:43 am
Location: Australia

Session Variables not working.

Post by Subaru »

Hi all.

I am building a PHP CMS at the moment, and for some reason it seems that my session variables are being stored. I am using a default setup of Apache / PHP / MySQL with Linux Fedora Core 2. I am unsure as to which versions theses all are, but they are the standard ones.

I am making a module to display the logged-in users information. For example.

"Welcome, Logged in as $user."
"Account Type: $thegroup"

When i make the user "login" it seems to parse through the login checks ok, and use the variables $user, $pass, $SESSION_['user'] and $SESSION_['pass'].

For some reason if i type

echo $SESSION_['user'];

It doesnt display anything.


Any ideas? :?
User avatar
chrys
Forum Contributor
Posts: 118
Joined: Tue Oct 04, 2005 9:41 am
Location: West Roxbury, MA (Boston)

Post by chrys »

Yes, the session global is $_SESSION not $SESSION_
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

and don't forget session_start(); at the top of your page :wink:
Subaru
Forum Newbie
Posts: 2
Joined: Wed Oct 12, 2005 8:43 am
Location: Australia

Post by Subaru »

Thanks guys, ill try out the swapped around session tags. If thats all it is im gonna feel like an idiot, but hey we all have to learn sooner or later.
Post Reply