Hi,
this is not the first time I'm working with PHP sessions, but I'm a bit puzzled.
Right now I'm working on a project for somebody who's webspace has PHP Version 4.4.4 (1and1.com hosting).
The sessions dont behave as expected.
session_id() gives me steady ids - thats ok.
It's possible to add data into $_SESSION array and use them.
E.g. $_SERVER[xy] = $_POST[xy] - is no problem.
But with the next call to another page or the same page the data is gone.
Like Preview-Page --> Result.page
I tried a couple of ini_set("session.use_cookies", "1") a.so. but result is the same - or it seems so.
Does anybody have an idea?
Here a link to the phpinfo: http://www.eifelstuff.com/phpinfo.php
THANKS!
Session looses its data
Moderator: General Moderators
-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
I had a similar problem where sometimes a page which included sessions would work sometimes and then not on others.
It turned out to be that the page hadn't got at the top of the page. So when I went to a page that had session_start(); set correctly it would make the other page work temporarily then stop as soon as the session stopped.
Hope that helps,
It turned out to be that the page hadn't got
Code: Select all
session_start();Hope that helps,
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
is it possible? Well I should hope so because that's the whole idea behind sessions 
Are you calling session_start() at the top of all the scripts that are setting and getting the $_SESSION vars.
Are you calling session_start() at the top of all the scripts that are setting and getting the $_SESSION vars.
please trydoes it show more than one value in _SESSION when you reload the page?
Code: Select all
<?php
error_reporting(E_ALL); ini_set('display_errors', true);
session_start();
if ( !isset($_SESSION['xyz']) || !is_array($_SESSION['xyz']) ) {
$_SESSION['xyz'] = array();
}
$_SESSION['xyz'][] = date('H:i:s');
?>
<html>
<head><title>session test</title></head>
<body>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">reload</a>
<pre>session: <?php var_export($_SESSION); ?></pre>
</body>
</html>