note 74114 deleted from function.session-destroy by bobby
| From: | bobby@php.net | Date: | Mon, 26 Mar 2007 14:39:24 +0000 |
| Subject: | note 74114 deleted from function.session-destroy by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124814@lists.php.net to get a copy of this message | ||
Note Submitter: Mr A_A
Reason: in docs
----
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!!