Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

session_destroy(3) [php man page]

SESSION_DESTROY(3)							 1							SESSION_DESTROY(3)

session_destroy - Destroys all data registered to a session

SYNOPSIS
bool session_destroy (void ) DESCRIPTION
session_destroy(3) destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start(3) has to be called. In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie(3) may be used for that. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Destroying a session with $_SESSION <?php // Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } // Finally, destroy the session. session_destroy(); ?> NOTES
Note Only use session_unset(3) for older deprecated code that does not use $_SESSION. SEE ALSO
unset(3), setcookie(3). PHP Documentation Group SESSION_DESTROY(3)

Check Out this Related Man Page

SESSION_UNREGISTER(3)							 1						     SESSION_UNREGISTER(3)

session_unregister - Unregister a global variable from the current session

SYNOPSIS
bool session_unregister (string $name) DESCRIPTION
session_unregister(3) unregisters the global variable named $name from the current session. Warning This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. PARAMETERS
o $name - The variable name. RETURN VALUES
Returns TRUE on success or FALSE on failure. NOTES
Note If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is used, use unset(3) to unregister a session variable. Do not unset(3)$_SESSION itself as this will disable the special function of the $_SESSION superglobal. Caution This function does not unset the corresponding global variable for $name, it only prevents the variable from being saved as part of the session. You must call unset(3) to remove the corresponding global variable. Caution If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(3), session_is_registered(3) and session_unregis- ter(3). PHP Documentation Group SESSION_UNREGISTER(3)
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

login seesions

Hello All, Is there any way to restrict the amount of idle time a user can have and then automatically kill the session? (1 Reply)
Discussion started by: namtab
1 Replies

2. UNIX for Dummies Questions & Answers

Cannot backspace on my session in CRT

Hi, when I make a mistake and then try to backspace I am unable to do so . Can someone please suggest How I can correct this on my session For Eg: pwd^H^H^H Thanks rooh (2 Replies)
Discussion started by: rooh
2 Replies

3. HP-UX

tracing a user's session

hi, does anyone knows how to trace a user session on a unix system: i want to log these things 1- login 2- date of starting session 3- date of closing session i've tryed who and last but they don't give closing time of session regards hmaiida (2 Replies)
Discussion started by: hmaiida
2 Replies

4. Shell Programming and Scripting

session limit in php

Sirs, How can i set the session.gc_maxlifetime value by php coding. Thanks ArunKumar (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

5. AIX

Logoff a user...

Hi... could anyone tell me how to kill a user session on my server with out affecting other user? Bala (6 Replies)
Discussion started by: balaji_prk
6 Replies

6. Shell Programming and Scripting

sqlplus session being able to see unix variables session within a script

Hi there. How do I make the DB connection see the parameter variables passed to the unix script ? The code snippet below isn't working properly. sqlplus << EOF user1@db1/pass1 BEGIN PACKAGE1.perform_updates($1,$2,$3); END; EOF Thanks in advance, Abrahao. (2 Replies)
Discussion started by: 435 Gavea
2 Replies

7. UNIX for Dummies Questions & Answers

Deleting a user session

I logged on yesterday and ran something that made my ID hang. I X'd out of the session and then logged on again and my ID from the original session is still there. I checked again this morning and the ID is still there (I checked using the WHO command). How can I kill that first session using... (7 Replies)
Discussion started by: jbrubaker
7 Replies

8. Solaris

kill user session

how do i kill a user session (10 Replies)
Discussion started by: fsmadi
10 Replies

9. Shell Programming and Scripting

saving a vi session

Apologies if this isn't quite the right thread I have a vi session and I have set a lot of tags with 'mx'. can I save this session preserving these tags so when I go back to the session I don't have to reset them all? cheers (0 Replies)
Discussion started by: ajcannon
0 Replies

10. Solaris

ifconfig -a not working

Hi All, I logged into a sun microsystems server box, using both a vnc session and a ssh session. I am able to use "ifconfig -a" in a ssh session, but the same on a vnc session says that its a invalid command. how is this possible, when i am logging into the same box through two different... (4 Replies)
Discussion started by: pardhuhere
4 Replies

11. UNIX for Advanced & Expert Users

.bash_history

During the course of the session before I logout I see some of the commands listed from my previous session but not from my current session and after I logout and log back in I see the commands which I ran before logging out. Does the .bash_history stay in the buffer or someplace else then? ... (2 Replies)
Discussion started by: jacki
2 Replies

12. HP-UX

SSh session hang

Hello, When I connect to a HP-UX 11.23 and/or 11.31 after a time without activity, the session hang. There is not TMOUT stablished, and the session NOT finish, always keep hang after about 20min of inactivity period. Anyone knows if this problem is related to HP-UX or network... (1 Reply)
Discussion started by: RuBiCK
1 Replies

13. Shell Programming and Scripting

Values passing out of isql session

hi .. i have a isql session which inside which i have two variables defined.. i wanna calculate % based on those variables. i knw i can easily do % calculation in csh if i could get the value of these variables passed outside the isql session . is tat possible ?? pls advice somthin like below... (1 Reply)
Discussion started by: Rahul619
1 Replies

14. UNIX for Advanced & Expert Users

Run only 3 sqlplus session at a time

Below code runs n number of session at a time when called. I want to restrict it to run only for 3 sqlplus at a time. Is there a way to do the same. for name in `cat abc.txt` do (sqlplus -s usert/password@host <<-EOF>> error.txt SET LINESIZE 1000 select '$name',... (4 Replies)
Discussion started by: ATWC
4 Replies