473,378 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

remove all session of user with onclick close button of browser

oranoos3000
107 100+
hi
i d like to when user click the close button all session of the user remover from the system
i user ajax fuction ajax that with onunload is called but result i want dont earn
thanks alot
Nov 17 '09 #1
4 7835
Dormilich
8,658 Expert Mod 8TB
remove the session cookie.
Nov 17 '09 #2
Atli
5,058 Expert 4TB
Hey.

Try the onbeforeunload event.
Nov 17 '09 #3
oranoos3000
107 100+
hi
would you please descibe with more details
Nov 21 '09 #4
Atli
5,058 Expert 4TB
You could use the onbeforeunload event to execute an AJAX request for a PHP file that would clear whatever sessions stuff you want cleared.

For example, using jQuery for the AJAX stuff:

index.html
Expand|Select|Wrap|Line Numbers
  1. window.onbeforeunload = function()  {
  2.     $.get('clear_session.php');
  3.     return 'The sessions have been cleared!';
  4. }
clear_session.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. session_destroy();
  4. ?>
This would bring up a prompt when the window or tab is closed, asking if the user really wants to close it. Meanwhile, the AJAX request is sent and the PHP code executed, clearing the session.
Nov 21 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: andrewkooi | last post by:
Greetings, I do not know whether such code exist but no harm asking: Is it possible for me to make visible a close button if the active window is a popup window or a new window (other than the...
3
by: Lord2702 | last post by:
Fri. Oct. 08, 2004 11:10 PM PT In ASP.NET application, How to detect that user has close the browser, IE or Netscape, or may be any other ? Thanks,
5
by: tshad | last post by:
If I am using FormsAuthentication, is there a way to check who is logged in? I want to be able to check at any particular time, not just how many people are logged in, but who they are. One...
13
by: lightzizo | last post by:
All, How can I disable or remove the close button in the screen. thanks
6
by: hemant.singh | last post by:
Hi all, I am trying to get a way by which I'll know exactly when user goes out of my site by clicking on close button in browser, So that w/e user click close button in browser, I can send a...
8
by: jaibux | last post by:
Everybody knows how to open (or clone) the same page that you are viewing in a new browser window by CTRL+N or via File->New Window. the question is how to PREVENT to open the SAME WEB APPLICATION...
1
by: sreedhardasi | last post by:
Hi, I would like to call a javascript function when user clicks on browser's close button. Here is the scenario. 1. User clicks browser close button. 2. User will be displayed a popup or a...
5
by: Tony | last post by:
I am continuing to develop an Access 2007 application which was originally converted from Access 2003. In Access 2003 I was able to disable the Access Close button in the top righthand corner of...
1
oranoos3000
by: oranoos3000 | last post by:
hi i,m writing a script for chat room i,d like to with clicking close button of browser user is exited from site meaning of this say is with clicking close button all of session variable is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.