Re: Version Independent Sessions?
| From: | dorgon | Date: | Thu, 19 Jun 2003 17:27:32 +0000 |
| Subject: | Re: Version Independent Sessions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152196@lists.php.net to get a copy of this message | ||
that's some of my scripts I once used.
have a look at it. it won't run instantly, since I just
took them from a collection of classes
hth
/Dorgon
the most interesting part will be:
// initialize global session object
session_start();
if (isset($_SESSION)) { // php versions >= 4.1.0
if (!isset($_SESSION['userSess'])) {
$_SESSION['userSess'] = new UserSession();
$sess =& $_SESSION['userSess'];
$sess->init();
}
else {
$sess =& $_SESSION['userSess'];
$_SESSION['userSess']->reuse();
}
}
else { // for downward compatibility to old php version (< 4.1.0)
if (!isset($userSess)) {
$userSess = new UserSession();
$sess =& $userSess;
$userSess->init();
session_register("userSess");
}
else {
$sess =& $userSess;
$userSess->reuse();
session_register("userSess");
}
}
Lee Herron Qcs wrote:
> Does anyone know of a working snippet to manage sessions using any
> combination of Register_Global and pre/post php v4.1?
>
> Would love to look at some examples ..
>
>