note 58075 added to function.session-destroy
| From: | visonardo at osu1 dot php dot net | Date: | Sun, 23 Oct 2005 14:10:19 +0000 |
| Subject: | note 58075 added to function.session-destroy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97459@lists.php.net to get a copy of this message | ||
in the manual says: when you use (or declared) a session var with $_SESSION you dont need to use
session_register and when you want to
well, a little note about it is follow:
<?php
session_start();
$item=$_SESSION['item'];
[............]
if(isset($_GET['salir']))
{
//session_unset(); to see that I (now) dont use session_unset() to destroy a session vars....
session_destroy();
?>
Since here, it has been destroy the session but not the variables, BUT when I use this page again
and is executed the session_destroy() now yes :| !! it destroy all globals variables of my last
session. It means that I need
1- destroy the session (not their vars)
2- when I run this script again without use session var (just like is in this script) it will
destroy the session vars, and note that it did the session destroy.
3- I tried too put it thus:
[.........]
if(isset($_GET['salir']))
{
//session_unset();
session_destroy();
session_destroy();
}
Obviously, it showed me an error message "Warning: session_destroy()
[function.session-destroy]: Trying to destroy uninitialized session in W:\www\carrito\changuito.php
on line xx"
Then, I cant use two time thus.
since here, I didnt use session_unset neither $_SESSION=array();
Other thing, in this manual says: if you use $_SESSION dont use session_unset(), you should use ...
$_SESSION=array();
well, it dont work in my script, but yes when I use session_unset();
NOTE: all it with php 5.0.4 and win2k
----
Manual Page -- http://www.php.net/manual/en/function.session-destroy.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58075
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58075&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58075&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58075&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58075&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58075&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58075&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58075&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58075&report=yes
Search -- http://master.php.net/manage/user-notes.php