PDA

View Full Version : PHP session issue



ShotoCon
29 Jan 2009, 09:23 AM
Hi there,

Hoping someone can shed some light on this for me.

Am working on an app on my own machine using php 5.2.6 with an IIS server and MySQL back end.

The big issue is the sessions. They were working fine until yesterday and all of a sudden, nothing! Was adding an Import/Export function to the admin section of the app when I noticed they werent working, though I didnt touch on the $_SESSION array at all for the new admin functions.

Have tested using the following code:

1.php


<?php
session_start();
$_SESSION['test'] = "hi";
echo "Session ID: ".session_id()."<br />";
echo "<a href=2.php>page 2</a>";
?>

2.php


<?php
session_start();
echo "TESTER: ".$_SESSION['test']."<br />";
echo "Session ID: ".session_id()."<br />";
echo "<a href=1.php>page 1</a>";
?>

As you can see, possibly the simplest session test ever created, outputs the session id so I can visually verify it and also passes one session argument and outputs for verification.

Unfortunately, although the session ids are both the same, nothing seems to be getting passed! $_SESSION['test'] doesnt output anything.

Havent touched anything to do with sessions, just wont do anything with them now, anyone see anything claringly obvious with this simple example - because I sure cant :redhot:

Anyway, anything that helps shed light on this situation will be greatly appreciated!

Cheers

Erik
09 Feb 2009, 05:19 PM
I don't see any problems in the code, must be environmental. Did you try a different browser? Does phpInfo() show anything strange in the session area?

-Erik