egroupware/phpgwapi/cron/stalesessions.php

34 lines
1.4 KiB
PHP
Raw Normal View History

2000-12-18 21:09:56 +01:00
<?php
/**************************************************************************\
* 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];
$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
$query = sprintf("delete from phpgw_sessions where session_dla <= '$purgetime'");
2000-12-18 21:09:56 +01:00
$res = mysql_query($query, $link);
?>