473,586 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

remove all session of user with onclick close button of browser

oranoos3000
107 New Member
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 7893
Dormilich
8,658 Recognized Expert Moderator Expert
remove the session cookie.
Nov 17 '09 #2
Atli
5,058 Recognized Expert Expert
Hey.

Try the onbeforeunload event.
Nov 17 '09 #3
oranoos3000
107 New Member
hi
would you please descibe with more details
Nov 21 '09 #4
Atli
5,058 Recognized Expert Expert
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.p hp
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
2670
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 main window)? What I mean is this: If the present window is the main window, then the close button should
3
2252
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
3700
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 thing I want to do is not allow someone to log on from one browser and then log on again at the same time time from another browser. Or to prevent...
13
22701
by: lightzizo | last post by:
All, How can I disable or remove the close button in the screen. thanks
6
3930
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 signal to server. This seems to be achievable with body unload events, but it is little too much, as even if user navigate within my site, this event...
8
10991
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 (with the same session) in two or more browser windows. any ideas? jaibux@gmail.com
1
11296
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 div with two buttons (Yes or No) by calling a Javascript function 3. "No" will close the window. 4. "Yes" will cancel the user action and redirect...
5
5875
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 the screen. I have been unable to find any way to disable this button in Access 2007 and subsequently I have been forced to find ways to detect and...
1
1607
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 removed from server i wrote below code for this action but sorry i failed please help me my base page code is as follows
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.