Skip to content Skip to sidebar Skip to footer

How Do I Alert Admin Users When Their Account Has Timed Out

The website I program for is a high school newspaper. Lately, the admin page has been having a trending issue. When by the time users have created an article, they have been logged

Solution 1:

How about you check - before unsetting the session - if there are, let's say, five minutes left?

if($_GET['endsession'] < time() + 5*60) {
    //alert the user
}

if($_GET['endsession']) {
    //your code to unset the session
}

Assuming $_GET['endsession'] contains a timestamp. If this is not the case you may as well transform it or whatsoever, but I think the general idea is clear.

Solution 2:

Maybe in your body tag:

<bodyonload="window.setTimeout(function() {window.alert('You have been logged out');},600000);">

This will put an alert in the browser at 10 minutes (600 seconds / 600,000ms) saying "You have been logged out".

You can also do it in the body for the same effect:

<script>window.setTimeout(function() {window.alert('You have been logged out');},600000);</script>

http://www.w3schools.com/jsref/met_win_settimeout.asp

Post a Comment for "How Do I Alert Admin Users When Their Account Has Timed Out"