RE: Sessions
| From: | James Duncan | Date: | Sun, 27 Aug 2000 19:39:00 +0000 |
| Subject: | RE: Sessions | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2189@lists.php.net to get a copy of this message | ||
So what you seem to be saying is that it's up to us to physically delete the
session file? The thing that worries me is that if I issue the
session_destroy command on the same page that originally opened the session
the contents of the session file is 0 bytes. However, when I session_destroy
the same session from another page the contents of the session file remain
(i.e. variables still in there and not 0 bytes). If we are supposed to
physically destroy the session file ourselves why the differences in
operation of the destroy command?
I can't simply leave the session file to be deleted by garbage collection
because if the user returns to the page that created the session variables
they are still present and populated with old data!
Also wherever I run session_destroy it ALWAYS returns false.
Comments, answers, help, divine intervention....
Thanks
James
-----Original Message-----
From: Klaus Schmidt [mailto:ks@ksweb.de]
Sent: 27 August 2000 19:09
To: James Duncan
Cc: php-windows@lists.php.net
Subject: AW: Sessions
yes, it the same here on
WIN98,Apache 1.3.12, PHP4.0.2dev (based on the actual file from php.net)
I tried the following and the Server ist clean, no 'orphan'-session-files
hope it works
<?
session_start();
$id=session_id(); // I didn't try so set this variables
'behind' the
$path=session_save_path(); // _unset() and _destroy ...up2u
$file = $path . "sess_" . $id;
echo $file."<br>";
@session_destroy(); // shows a warning without that '@' :-)) an doesn't
destroy the file
// but without that line the unlink() don't works.
// so it seems that any important internal link/index
is destroyed!
echo unlink($file); // success
?>
outputs:
C:\usr\htdocs\ksweb\sessions\sess_6a8f3ec2809f5fa3b2a0975ab3191629
1
cu Klaus
p.s.:
here a important text from php.net.manual:
(hope you know that)
theo@alldarlings.com
09-Jan-2000 01:54
<PRE>
What session_start does is looks for an existing session, and if none
exists, it creates a new one. What it also does (that wasn't fully eplained
above by the statement "initializes variables" is looks for any session
variables, and sets them globally on the page that start got called from. If
you have any variables already set (say from a get/post from the previous
page) they will get overwritten. Also, changing a variable on a page will
not update its session counterpart.
Also, note that any call to session_register will automatically call
session_start (and therefore pull all session variables and set their local
counterparts.)
If I wasn't so lazy, I'd upload an example of what I mean.
</PRE>