note 74114 added to function.session-destroy
| From: | MrA_A at osu1 dot php dot net | Date: | Sun, 25 Mar 2007 22:39:59 +0000 |
| Subject: | note 74114 added to function.session-destroy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124798@lists.php.net to get a copy of this message | ||
I hope every body to understand seesion values, and how to work with session, because mostly session
used for security reson. try to secure your self with PHP it's great.
Note: I used PHP tag only for fantastic the code,
<?PHP
session_start();
//No Session value set! and session was not destroyed
is_array($_SESSION['yoursession'])=== FALSE // True
is_null($_SESSION['yoursession']) === TRUE // True
isset($_SESSION['yoursession']) === FALSE // True
empty($_SESSION['yoursession']) === TRUE // True
$_SESSION['yoursession'] == FALSE // True
is_array($_SESSION)=== TRUE // True
is_null($_SESSION) === FALSE // True
isset($_SESSION) === TRUE // True
empty($_SESSION) === TRUE // True
$_SESSION == FALSE // True
?>
<?PHP
session_start();
//assume $_SESSION['yoursession']="value"; now we destry all session!
$_SESSION=array();
$_SESSION['yoursession'] = array();
session_destroy();
is_array($_SESSION['yoursession'])=== TRUE // True
is_null($_SESSION['yoursession']) === FALSE // True
isset($_SESSION['yoursession']) === TRUE // True
empty($_SESSION['yoursession']) === TRUE // True
$_SESSION['yoursession'] == FALSE // True
is_array($_SESSION)=== TRUE // True
is_null($_SESSION) === FALSE // True
isset($_SESSION) === TRUE // True
empty($_SESSION) === FALSE // True
$_SESSION == TRUE // True
?>
Now you can build your own expression
if(is_null($_SESSION['yoursession']) === TRUE){
//it means no session is set
echo "Welcome Guest!";
}
and so on.
enjoy!!
----
Server IP: 69.147.83.197
Probable Submitter: 75.126.48.146
----
Manual Page -- http://www.php.net/manual/en/function.session-destroy.php
Edit -- https://master.php.net/note/edit/74114
Del: integrated -- https://master.php.net/note/delete/74114/integrated
Del: useless -- https://master.php.net/note/delete/74114/useless
Del: bad code -- https://master.php.net/note/delete/74114/bad+code
Del: spam -- https://master.php.net/note/delete/74114/spam
Del: non-english -- https://master.php.net/note/delete/74114/non-english
Del: in docs -- https://master.php.net/note/delete/74114/in+docs
Del: other reasons-- https://master.php.net/note/delete/74114
Reject -- https://master.php.net/note/reject/74114
Search -- https://master.php.net/manage/user-notes.php