Click here to Skip to main content
15,910,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m currently using this for inactive users, those that are not been active on the site

Using this is it possible to tell the user session expired please login again? I mean a friendly message like " your session have expired please login again."

HTML
<meta http-equiv="refresh" content="600;url=logout.php" />
Posted
Updated 8-Dec-15 3:34am
v2
Comments
Suvendu Shekhar Giri 8-Dec-15 9:55am    
Not Clear. When you want to show the message? and where? and how?
Any code you have tried for showing message?
iDoKin 8-Dec-15 10:02am    
I don't have the code that shows the message. I was wondering if that is possible using the code above. If the time 600 pass, it will logout the user. The browser refresh when time is 600 and go to logout page. So is there a way to give a message to the user to notify them that they need to login again?

1 solution

I suppose your method may work and you'd have to have it on every page.

Usually this is done using some form of timers in JavaScript. Since the web is a disconnected medium you have to have something fire on the client side and therefore you use JavaScript.

For example, you can call setTimeout(logoutFunction, sessionTimeInMilliseconds). If the time passes then JavaScript will call your logoutFunction which you can then popup a message or redirect or whatever you want.

You can get more sophisticated too. For example, you can display a message when they are 10 minutes away from logout by subtracting 10 minutes from the delay parameter of setTimeout.

This is such a common request that I wonder if there are not libraries to help make it easier already. I'd suggest googling for other ways to handle this. It isn't hard to do but would be nice if someone has already got a nice clean and easy-to-use plugin.
 
Share this answer
 
Comments
iDoKin 9-Dec-15 2:06am    
@RyanDev thanks hey. I will go through google on the search for libraries that will make my job easy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900