Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 2nd, 2006, 04:17 PM
Authorized User
 
Join Date: Apr 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to chayanvinayak
Default how to clear session variabl when browse is closed

My page create session using userid when user login ,how can i clear session variables when user closes browser/windows using which he has logged.


chayan vinayak goswami
__________________
chayan vinayak goswami
 
Old May 17th, 2006, 04:12 AM
Authorized User
 
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is last page through which you are requsting for log out
<html>
<head>
<title>
Home Page
<body>
<form>
<a href="log_out.php?logout='logout'">[u]Logout</u></a>
</form>
</body>
</html>

The File Name is log_out.php >>>
In this page i clear all the value which stored in session.
<?php
session_start();
if($_REQUEST['logout']='logout')
{
  session_unset();
  session_destroy();
  include "log.php";
  echo "you Are Successfully Log Out, Thanks for Visiting<br>";
}
?>
I hope it will help you.

with best regards
Shekhar Srivastava

 
Old May 17th, 2006, 01:01 PM
Authorized User
 
Join Date: Apr 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to chayanvinayak
Default

I need the code for -: , as soon as the user clicks on the close button of browser , session get destroyed.( not by clicking any button) .

thanks


chayan vinayak goswami
 
Old May 22nd, 2006, 04:59 AM
Authorized User
 
Join Date: Mar 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You cant do that. The session data is automatically destroyed when the the user closes the browser window.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Browse File mgnishan PHP How-To 2 March 23rd, 2007 01:54 PM
clear all session variable whenusing browser back nax111 ASP.NET 1.0 and 1.1 Professional 0 November 20th, 2006 04:17 AM
how to destroy session when window is closed chayanvinayak PHP How-To 1 June 1st, 2006 06:18 AM
pulling html from a web site into a string variabl David SF Excel VBA 2 December 19th, 2005 04:24 PM
Browse Dialog for MSWord ddonnahoe Access VBA 1 January 22nd, 2004 04:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.