Re: Trigger an action on session timeout - feature request?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is there any possibility to trigger an action when the session is inactive for some time? I need to log users' login and logout, and so I need to know
about logouts caused by timeout. Neither there seems to be a possibility
of a workaround like walking through all my sessions for timeouted ones
and destroy them myself.

if you want it server side, it would have to be some kind of scheduled job (cron, etc). Most banks have session timeouts using javascript or asp, client side. You do this with php by putting the session timeout duration into javascript, then a settimeout and if browser closed... etc.. the default in php.ini is 24 minutes... u can use this, or use any value...... then have logout.php clean up

<?php

$timeout = ini_get('session.gc_maxlifetime') * 1000 // convert from seconds to milliseconds for javascript;

?>

<html>
<head>
<script type="text/javascript">
<!--
setTimeout("window.location = 'logout.php'",<?php echo $timeout?>);
// -->
</script>
</head>
<body>

</body>
</html>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux