How to log out member who is inactive?

I have a member who stays connected to the website for days on end, consuming CPU usage. I know that there is a admin adv setting to make them inactive, but is there a way to log them out so not to query messenger and use cpu?

Vunderba..... Challenge Yourself to be the Best...... Hosting from Zarconia.net
Quote · 24 Apr 2013

what you can try is to build in lil script that checks if the logged in member is not really active( idle time).

if not then kill session after say: 60 min. I know this mod: Chat Auto Logout.
Maybe other programmer here knows how to build a time out session for the site itself and not just chat.

Quote · 24 Apr 2013

Thank you for the reply. This mod or program would be useful. Hopefully someone has a small script that does this for dolphin. Otherwise anyone that has members stay online for convenience can definitely be a resource hog.

Vunderba..... Challenge Yourself to be the Best...... Hosting from Zarconia.net
Quote · 24 Apr 2013

You are welcome.

you can do it with java script see example

var inactivityTime =function(){var t; window.onload = resetTimer; document.onmousemove = resetTimer; document.onkeypress = resetTimer;function logout(){ alert("You are now logged out.")//location.href = 'logout.php'}function resetTimer(){ clearTimeout(t); t = setTimeout(logout,3000)// 1000 milisec = 1 sec}};

 

if you have programming skills you can do it... be carefull where you put the code. have not used it myself yet.
Always backup your files before you make any changes...

Quote · 24 Apr 2013

You could try this:

Edit -> templates/base/_header.html

ADD this code right before the </head>

<script language="javascript" type="text/javascript">

var timeOut;

function reset() {
    window.clearTimeout(timeOut);
    timeOut = window.setTimeout( "redir()" , 1800000 );
}

function redir() {
    window.location = "logout.php";
}

window.onload = function() { setTimeout("redir()" , 1800000 ) };

window.onmousemove = reset;
window.onkeypress = reset;

</script>

It's set for 30 minutes. If the user doesn't move their mouse or press a key, they will be logged out.

You can test this by making the timer shorter, say 10000 and reloading your website.

http://ModMyCMS.com --> Dolphin Hacks &Mods
Quote · 24 Apr 2013

just tested it and it works fine.

good luck

Quote · 24 Apr 2013

TY, will try and let everyone know.

Vunderba..... Challenge Yourself to be the Best...... Hosting from Zarconia.net
Quote · 25 Apr 2013

It can have place in browser window, but usually this doesn't happen, or at least above solution should help.

One more thing is desktop app, which stays in tray and make periodic requests to the server - user has to close it explicitly to stop it. The solution here is to uninstall Desktop app module, to prevent future installs. 

I have a member who stays connected to the website for days on end, consuming CPU usage. I know that there is a admin adv setting to make them inactive, but is there a way to log them out so not to query messenger and use cpu?

 

Rules → http://www.boonex.com/terms
Quote · 25 Apr 2013

Worked perfectly,  TY all again

Vunderba..... Challenge Yourself to be the Best...... Hosting from Zarconia.net
Quote · 25 Apr 2013

No problem!

http://ModMyCMS.com --> Dolphin Hacks &Mods
Quote · 25 Apr 2013

I suggest to change this block of code

window.onload = function() { setTimeout("redir()" , 1800000 ) };

window.onmousemove = reset;
window.onkeypress = reset;

to this

if (unescape(document.cookie.replace(new RegExp("(?:(?:^|.*;s*)" + escape("memberID").replace(/[-.+*]/g, "$&") + "s*=s*((?:[^;](?!;))*[^;]?).*)|.*"), "$1")) || null) {
        window.onload = function() { setTimeout("redir()" , 1800000 ) };

        window.onmousemove = reset;
        window.onkeypress = reset;
}

This prevents the script to logout again and again even the user is already logged out.

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 25 Apr 2013

I just saw that the original code doesn't reset the timer (maybe in IE it is doing). So i changed something (Event handling over "document"). Here is the complete working code (tested on FF, Chrome and IE8)

<script language="javascript" type="text/javascript">
var timeOut;
function reset() {
    window.clearTimeout(timeOut);
    timeOut = window.setTimeout( "redir()" , 1800000 );
}
function redir() {
    window.location = "logout.php";
}
if (unescape(document.cookie.replace(new RegExp("(?:(?:^|.*;s*)" + escape("memberID").replace(/[-.+*]/g, "$&") + "s*=s*((?:[^;](?!;))*[^;]?).*)|.*"), "$1")) || null) {
        document.onload = function() { window.setTimeout("redir()" , 1800000 ) };

        document.onmousemove = reset;
        document.onkeypress = reset;
}
</script>

There needs to be another change made i have no time yet because i leave the house. Under Chrome/FF if you navigate to another page and stop to move the mouse before the page is loaded the timer will not be set. If you move the mouse then it works. IE works from the beginning even you not move the mouse. I read there is some difference between the browsers, like always..... Normally nobody loads a page without moving the mouse a little bit after the click. Anyway, I will fix it later...

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 25 Apr 2013

It would be nice to add a pop up saying your session is about to expire click on continue to stay logged in. 

Sort of like what godaddy.com uses when you stay idle on there site to long. 

Also how well will this play with memcache or accelerator if the cookie times are set different  ? or will it not matter at all ?

https://dolphin-techs.com - Skype: Dolphin Techs
Quote · 25 Apr 2013

Some people like to stay logged in for convenience.  They may leave the computer for a time and then return to look for new updates and comments.  Logging them out too quickly is going to caused irritation and they may be inclined to just go elsewhere.  So temper the amount of time you are thinking of a forced log-out.  Here on Boonex, we can stay logged in for a week before we are logged out of the system.

Note, doesn't the session cookie handle this?  Or is the session cookie set to expire for an extremely long time?  If so, isn't the answer to reduce the time the session cookie expires?

Geeks, making the world a better place
Quote · 25 Apr 2013

yeah but boonex is not using live chat or messenger and is not getting hit with a million xml calls....   

https://dolphin-techs.com - Skype: Dolphin Techs
Quote · 25 Apr 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.