RE: [PHP-WIN] RE: Sessions
| From: | Jeroen ten Berge | Date: | Mon, 28 Aug 2000 00:00:04 +0000 |
| Subject: | RE: [PHP-WIN] RE: Sessions | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2191@lists.php.net to get a copy of this message | ||
I'm using php 3.0.16 which hasn't got session stuff in it, I created a
session a like code that store's session's on our DB, I only set a cookie
for the ID (which can also be doen as a hidden form field)
After the user has done the last bit the session is destroyed just by
deleting the record, it works like a glance !
If you like to obtain the source code, just reply...
Regards,
Jeroen.
-----Original Message-----
From: James Duncan [mailto:jd@jamesduncan.co.uk]
Sent: Monday, August 28, 2000 01:26
To: Klaus Schmidt
Cc: php-windows@lists.php.net; Daniel Beulshausen
Subject: [PHP-WIN] RE: Sessions
Something weird is happening because session_unregister doesn't work (i.e. I
can still echo the global variable after unregister) but session_unset does
work. Still can't get the session file to 0 bytes with a session_destroy()
from another page, which is what is supposed to happen? Session_destroy()
always reports failure ;(
Thanks for the code below. Unfortunately "unlink" isn't built into my
version of PHP :( So I've had to use the following work around:
exec("cmd nul /c \"del $file\"");
This completely deletes the session file from the server. You are right in
that this only works after a "session_destroy()", so the destroy command is
doing something! Physically deleting the session file does give me a work
around but it's a rather nasty hack in my opinion. Surely
"session_destroy()" should work properly on Windows? Has anyone managed to
get it to work correctly?
Thanks
-----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>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
For additional commands, e-mail: php-windows-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net