mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-03 11:59:16 +01:00
Updated things to the new session table layout
This commit is contained in:
parent
ae92199c92
commit
d252cfb1f7
@ -1,4 +1,16 @@
|
|||||||
<?php
|
<?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$ */
|
||||||
|
|
||||||
// stalesession.php - to use instead of stalesession.pl
|
// stalesession.php - to use instead of stalesession.pl
|
||||||
// may be invoked via cron with "php stalesession.php"
|
// may be invoked via cron with "php stalesession.php"
|
||||||
|
|
||||||
@ -6,7 +18,7 @@
|
|||||||
$purgedelay = "3600"; // define allowed idle time before deletion in seconds
|
$purgedelay = "3600"; // define allowed idle time before deletion in seconds
|
||||||
$purgetime = time() - $purgedelay;
|
$purgetime = time() - $purgedelay;
|
||||||
$db_user = $ARGV[1];
|
$db_user = $ARGV[1];
|
||||||
$db_pwd = "phpgr0upwar3";
|
$db_pwd = "my_pass";
|
||||||
$db_server = "localhost";
|
$db_server = "localhost";
|
||||||
$db_db = "phpGroupWare";
|
$db_db = "phpGroupWare";
|
||||||
// config end - do not edit after here unless you really know what you do!
|
// config end - do not edit after here unless you really know what you do!
|
||||||
@ -16,6 +28,6 @@
|
|||||||
mysql_query("use $db_db", $link);
|
mysql_query("use $db_db", $link);
|
||||||
|
|
||||||
// delete old (timed out) sessions
|
// delete old (timed out) sessions
|
||||||
$query = sprintf("delete from sessions where dla <= \"$purgetime\"");
|
$query = sprintf("delete from phpgw_sessions where session_dla <= '$purgetime'");
|
||||||
$res = mysql_query($query, $link);
|
$res = mysql_query($query, $link);
|
||||||
?>
|
?>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
# * Free Software Foundation; either version 2 of the License, or (at your *
|
# * Free Software Foundation; either version 2 of the License, or (at your *
|
||||||
# * option) any later version. *
|
# * option) any later version. *
|
||||||
# \**************************************************************************/
|
# \**************************************************************************/
|
||||||
|
# $Id$
|
||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ use DBI;
|
|||||||
$db_host = 'localhost';
|
$db_host = 'localhost';
|
||||||
$db_name = 'phpGroupWare';
|
$db_name = 'phpGroupWare';
|
||||||
$db_user = 'phpgroupware';
|
$db_user = 'phpgroupware';
|
||||||
$db_pass = 'phpgr0upwar3';
|
$db_pass = 'my_password';
|
||||||
|
|
||||||
# Email users when they don't log out ?
|
# Email users when they don't log out ?
|
||||||
# If you are selecting this option. You might want to customize the message
|
# If you are selecting this option. You might want to customize the message
|
||||||
@ -30,7 +31,7 @@ $email_user = 'Y';
|
|||||||
$sendmail_location = '/usr/sbin/sendmail';
|
$sendmail_location = '/usr/sbin/sendmail';
|
||||||
|
|
||||||
# Where should the message be comming from ?
|
# Where should the message be comming from ?
|
||||||
$message_from = "webmaster\@athens.prv";
|
$message_from = "webmaster\@mydomain.com";
|
||||||
|
|
||||||
# This is how long a user can be at idle before being deleted. Look at the
|
# This is how long a user can be at idle before being deleted. Look at the
|
||||||
# SECURITY file for more information.
|
# SECURITY file for more information.
|
||||||
@ -50,17 +51,16 @@ $dbase = DBI->connect("DBI:mysql:$db_name;$db_host",$db_user,$db_pass);
|
|||||||
$staletime = time() - $secs_to_stale;
|
$staletime = time() - $secs_to_stale;
|
||||||
|
|
||||||
if ($email_user eq 'Y') {
|
if ($email_user eq 'Y') {
|
||||||
$command = $dbase->prepare("select loginid,logintime,ip,sessionid from "
|
$command = $dbase->prepare("select session_lid,session_logintime,session_ip,session_id from "
|
||||||
. "sessions where dla <= '$staletime'");
|
. "phpgw_sessions where session_dla <= '$staletime'");
|
||||||
$command->execute();
|
$command->execute();
|
||||||
|
|
||||||
while (@session_data = $command->fetchrow_array()) {
|
while (@session_data = $command->fetchrow_array()) {
|
||||||
send_message($session_data[0],$session_data[1],$session_data[2]);
|
send_message($session_data[0],$session_data[1],$session_data[2]);
|
||||||
$command2 = $dbase->do("delete from sessions where sessionid='"
|
$command2 = $dbase->do("delete from phpgw_sessions where session_id='$session_data[3]'");
|
||||||
. "$session_data[3]'");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$command = $dbase->do("delete from sessions where dla <= '$staletime'");
|
$command = $dbase->do("delete from phpgw_sessions where session_dla <= '$staletime'");
|
||||||
}
|
}
|
||||||
|
|
||||||
#$command->finish();
|
#$command->finish();
|
||||||
|
Loading…
Reference in New Issue
Block a user