Configuration: apache, php 4 (mod), mysql
I'm using PHPLib's session support (mainly because it was easier to re-use the auth, perm, and sess classes than to create my own).
My problem is that the session variables don't seem to go away when I want them to. Here's roughly what I'm doing. (Note: this single file contains a form that points back to this page. The session vars are created in one page view, but unregistered in a later view of this same page.)
foo.php:
printf("Is myvar registered? %s",($sess->is_registered("myvar")) ? "YES" : "NO");
if (!$sess->is_registered("myvar))
{
$myvar = "blah";
$sess->register("myvar");
}
// do a bunch of other stuff in this file
unset($myvar); // forgets the global var $myvar
printf("myvar = %s",$myvar); // this is a test
$sess->unregister("myvar"); // forgets the session var $myvar
printf("Is myvar registered? %s",($sess->is_registered("myvar")) ? "YES" : "NO");
The first time the script runs, myvar is not registered. After I unregister myvar at the end of the file, "Is myvar registered?" says NO. But if I were to request foo.php anytime later during this session, it reports "Is myvar registered? YES" at the top of the file.
I'd really really appreciate any help.
Session variables are the cleanest and most "elegant" way for me to do what I need to do here. And I'd really like to get it to work properly.
Thanks,
DLB