Hi,
having problems with sessions. To simplify I have reduced my script to a short sample
<?php
session_start();
if (!array_key_exists('count',$_SESSION)) {
$count = 1;
$_SESSION['count'] = $count;
} else {
$count = $_SESSION['count'];
$count++;
$_SESSION['count'] = $count;
}
?>
Hello, Visitor! You have seen this page <?php echo $count; ?> times....<p>
This link works <A HREF="test2.php?<?php echo strip_tags (SID)?>">click here</A>
<br><br>
This link does not <A HREF="test2.php">click here</A>
What should happen is that a refresh, or when either of the links are clicked, the counter should increase. This works fine on other servers. However on a server running Apache 2, PHP 5 and Windows XP (can't be changed) the session is lost when the second link is clicked or a refresh is done. In fact if I print out the session id, it changes after a refresh or when the second link is clicked.
I have registered global variables off, but even when I turn it on to test, it still does not work. Anyway the other servers I can test the script on works fine with global variables off. A screen shot of my session settings in php.ini is attached.
I have also checked the session.save_path ("c:\php\PHPSESSION") to see if the data session are being saved here and the session files are being created, e.g. "sess_0m0rak74vthbqrucvcs0qk88t1" is created for a session id of 0m0rak74vthbqrucvcs0qk88t1. And count and its value are being saved to this file when I open it in textpad
I know a solution to the problem would be to set
session.use_trans_sid = On
However I would like to avoid that if at all possible.
This has been annoying me for 2 days now. I have tried some suggestions form other posts such as turning of windows firewall to no avail. Any assistance would be greatly appreciated.
Donal