473,788 Members | 2,856 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

run code on session destroy

17 New Member
I need to find a way when a user closes the browser (not a refresh), to make a log entry into a txt file of the date/time logged out. I have a logout function, but it only works if they hit the log out button. I need to be able to run some code to see if a session is destroyed on the server to make a log entry. Users will be frequently logging in/out & I need to record each entry, so a cronjob will not work. I have not found a way in javascript to distinguish between a refresh or a close. I think checking if the session is destroyed & if it is, then make a log entry would be a good train of thought, but I do not know how.

Any suggestions?
Dec 4 '07 #1
2 1802
Markus
6,050 Recognized Expert Expert
Would

<body onunload="javas criptFunction() ">

work?
Dec 4 '07 #2
ktrw25
17 New Member
Unfortunately that code runs when you refresh the page and when you click the close button. I only want it to happen when the page has been closed
Dec 4 '07 #3

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

Similar topics

3
6513
by: Derek Fountain | last post by:
The documentation says session_destroy() "destroys all of the data associated with the current session". Um, like what? The docs further say that you should remove all information in the _SESSION global with $_SESSION = array() and you should use setcookie() to set the session cookie to a blank value. Having done those, what does that leave session_destroy() to do? The page at http://au2.php.net/manual/en/function.session-destroy.php...
2
5334
by: David Popeck | last post by:
I have an ASP.NET application that is using forms authentication and I want to know when a session has timed out I have read quite a lot of posts here about this but no-one seems to have to same issue Rather than telling the user that a timeout has occured I want to know on the server so I can call a stored procedure Adding code to Session_End in global.asax doesn't help because this only gets called when Session.Destroy is called and not...
8
2262
by: TristaSD | last post by:
Hi, I'm trying to tweak the logout script on my web projects. When I point users to a logout.php page containing the session_destroy() function, I get the "Trying to destroy uninitialized session" error. Any ideas? Thanks.
6
18227
by: somaskarthic | last post by:
Hi This is somas here. I asked query about detecting the browser close event using javascript. I want to detect the event only when the X button in the top right corner is clicked and not else where. (like moving to other pages by clicking some links). Can u help me in this case. Cause of this , In my php site, i want to restrict multiple logins with same username and password at a same time from different system. To avoid this , in...
43
3439
by: davidkoree | last post by:
I mean not about cookie. Does it have something to do with operating system or browser plugin? I appreciate any help.
5
3117
by: bnashenas1984 | last post by:
Hi I'm using IIS on windows XP SP2 just for designing my website. Everything is working fine except session_destroy. When I destroy the session with php nothing happends and session is still available but when I upload the script on my website it works. I think there must be something wrong with my configuration. Doe's anyone know what the exact reason is? Thanks
3
13928
by: T. Wintershoven | last post by:
Hi all, After a visitor has loged in, a session is started. The session is destroyed after the visitor clicked "Log out'. When the visitor forgets to log out and closes the browser immediately, the session stil exists because when the visitor opens the browser again and comes back to the site he/she is still loged in. Ofcourse i don't want that. I want the session to be destroyed when the visitor closes the browser
1
2039
oranoos3000
by: oranoos3000 | last post by:
hi I 'd like to session destroy when that user for 1 hours dont dont press any key or scroll page and dont go to another or in other words stay in one page for a alot of time thanks alot
1
3083
oranoos3000
by: oranoos3000 | last post by:
hi i'd like to destroy sessions for logging out logged in user with onuload event from brower i wrote a script that with onunload event brower a function is ran that is writen with jquery and inside this function i send a request for a php file that only destroy session but unfortunately my user is'nt logged out information logged in users that is saved in database is consist of username , ip address thanks alot sepideh mohseni
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10373
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7519
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.