PHP session returns null and not set

Ok, so I logged onto my website. I looked up on my control panel and instead of “Logout”, like should’ve been displayed it displays “login” after just having logged in. I put the session_start() right after the opening php tag (before headers are sent), so I decided to dump them to see what it returns and I get null. The session is named “Logged_in” and it’s created when the user logs in or registers. Here’s the specific code.

Login.php
[php]

<?php session_start(); … $_SESSION['Logged_in']=$Username; header("Location: ../Community/profile.php?user=$UserN"); ?>

[/php]

profile.php
[php]

<?php session_start(); var_dump($_SESSION['Logged_in']); ?>

[/php]

session info
http://forums.htmlhelp.com/index.php?act=Attach&type=post&id=2332

Well, it should be null. What is your question?

The first page starts a new session. Okay!
Then, you create a new SESSION variable in the SESSION[] array. Okay!
Next, you set that new SESSION variable to an empty unassigned variable. Okay!
Lastly, you switch to another page. Okay!

All of these are valid and okay! There is no setting of the variable $username ! ! !
If you changed line #5 to $_SESSION[‘Logged_in’]=“some value”; then it would pass that value.
But, setting it to nothing passes nothing…

Is that what you want to know?

Sponsor our Newsletter | Privacy Policy | Terms of Service