automatic logout when browser closes

Security issues related to php and mysql usage. How to make your code secure? Security measures and configurations? It's all in here!

Moderators: macek, egami, gesf

Ronald
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Mar 13, 2012 7:15 pm

automatic logout when browser closes

Postby Ronald » Tue Mar 13, 2012 7:25 pm

HI GUYS..

im new in php..

i have this javascript for logout if user is inactive.. How can a user be automatically be loggedout when they close the browser.

<script type="text/javascript">
window.onload = function () {
refreshy = setTimeout("window.location='logout.php' ", 60000); //seconds
}
window.onmousemove = function() {
stopCount();
startCount();
}
function stopCount() {
clearTimeout(refreshy);
}
function startCount() {
refreshy = setTimeout("window.location='logout.php' ", 60000);
}
</script>

Return to “PHP & MySQL Security”

Who is online

Users browsing this forum: No registered users and 0 guests