If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > php session

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-03-09, 12:13
gidmakus gidmakus is offline
Registered User
 
Join Date: Nov 2009
Posts: 1
php session

hi buddies,

i wanted help on a session that i have created a page and i wanted it to expire the moment u leave the page with the session attached.

Can anyone help me out... thanks

Last edited by gidmakus; 11-03-09 at 12:14. Reason: the way i addressed
Reply With Quote
  #2 (permalink)  
Old 11-18-09, 11:02
marcin_koss marcin_koss is offline
Registered User
 
Join Date: Nov 2009
Posts: 9
How about urging user to logout before he closes the page?
Reply With Quote
  #3 (permalink)  
Old 02-03-10, 11:48
bharanidharanit bharanidharanit is offline
Registered User
 
Join Date: Nov 2008
Posts: 115
Hi try this, make a logout button and add this coding,
Code:
<?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();
?>
Reply With Quote
  #4 (permalink)  
Old 03-24-10, 03:05
nevin nevin is offline
Registered User
 
Join Date: Mar 2010
Posts: 8
the logic is that it is to set session expire till 00, also a code for deleting cookies will be much helpful to use bcoz
these have almost every info you send to the web. so deleting them is also a very good idea.

Last edited by nevin; 03-24-10 at 03:31.
Reply With Quote
Reply

Tags
expire, php expire, php session, session

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On