2000-12-18 21:09:56 +01:00
|
|
|
<?php
|
2001-01-10 13:06:48 +01:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-12-18 21:09:56 +01:00
|
|
|
// stalesession.php - to use instead of stalesession.pl
|
|
|
|
// may be invoked via cron with "php stalesession.php"
|
|
|
|
|
|
|
|
// config start
|
|
|
|
$purgedelay = "3600"; // define allowed idle time before deletion in seconds
|
|
|
|
$purgetime = time() - $purgedelay;
|
|
|
|
$db_user = $ARGV[1];
|
2001-01-10 13:06:48 +01:00
|
|
|
$db_pwd = "my_pass";
|
2000-12-18 21:09:56 +01:00
|
|
|
$db_server = "localhost";
|
|
|
|
$db_db = "phpGroupWare";
|
|
|
|
// config end - do not edit after here unless you really know what you do!
|
|
|
|
|
|
|
|
// establish link:
|
|
|
|
$link = mysql_connect("$db_server","$db_user","$db_pwd");
|
|
|
|
mysql_query("use $db_db", $link);
|
|
|
|
|
|
|
|
// delete old (timed out) sessions
|
2001-01-10 13:06:48 +01:00
|
|
|
$query = sprintf("delete from phpgw_sessions where session_dla <= '$purgetime'");
|
2000-12-18 21:09:56 +01:00
|
|
|
$res = mysql_query($query, $link);
|
|
|
|
?>
|