...

View Full Version : session_register help plz.



Leeoniya
06-11-2007, 10:23 PM
session_start();

if (!isset($_SESSION['pears'])) {
echo "pears were not set";
session_register ("pears");
$pears = dmondindex("pear");
}

if (!isset($_SESSION['pears'])) {
echo "rounds were not set";
session_register ("rounds");
$rounds = dmondindex("round");
}

dmondindex is a fairly lengthy parsing function that only needs to be done once per session. the above code doesn't seem to set the session variables properly because every time i refresh my browser i get the echo messages, instead of just the first time around

thanks,
Leon

Sayonara
06-11-2007, 10:45 PM
It looks like register_globals might be turned off on your server (this has been the default setting since PHP 4.2.0, and it is removed altogether in version 6).

You should instead use the $_SESSION array:
http://uk.php.net/manual/en/reserved.variables.php#reserved.variables.session

Leeoniya
06-11-2007, 10:49 PM
yep already solved. thanks.


session_start();

if (!isset($_SESSION['pears'])) {
$_SESSION['pears'] = dmondindex("pear");
}

if (!isset($_SESSION['rounds'])) {
$_SESSION['rounds'] = dmondindex("round");
}

$pears = $_SESSION['pears'];
$rounds = $_SESSION['rounds'];



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum