Here is my problem. I have a site into which users can login. It has a logout button to let the user log out. My problem is when they close the browser without logging out, how can I close the logged in entry in the database?? I need a way to run a piece of php script when the browser closes or if a session ending can trigger this. (Since the session is suppose to end when they close the browser.)
rajesh1158
-6
Light Poster
Roshan_10
commented:
Set session time out for every 24hr. And now check if session exists or not. If it doesn't exist, execute query to insert necessary log into database.
+0
Recommended Answers
Jump to PostThe session isn't supposed to end when the browser closes. You can run a js script, which could do it - through ajax (php).
$(document).ready(function() { $("a").click(function() { remain = this.href.Search("www.example.com"); if (remain == -1) { return(confirm("You wanna logout first?")); } return true; }); });
I got …
All 3 Replies
diafol
rajesh1158
-6
Light Poster
Roshan_10
commented:
Set session time out for every 24hr. And now check if session exists or not. If it doesn't exist, execute query to insert necessary log into database.
+0
diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.