2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - administration *
|
|
|
|
* 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-11-21 01:41:31 +01:00
|
|
|
$phpgw_info = array();
|
2000-11-16 09:00:18 +01:00
|
|
|
$phpgw_info["flags"] = array("currentapp" => "admin", "enable_nextmatchs_class" => True);
|
2000-08-18 05:24:22 +02:00
|
|
|
include("../header.inc.php");
|
2000-08-21 05:15:59 +02:00
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_file(array( "header" => "accesslog.tpl",
|
2000-08-21 05:15:59 +02:00
|
|
|
"row" => "accesslog.tpl",
|
|
|
|
"footer" => "accesslog.tpl" ));
|
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_block("header","row","footer");
|
2000-08-21 05:15:59 +02:00
|
|
|
|
2000-08-18 05:24:22 +02:00
|
|
|
$show_maxlog = 30;
|
2000-08-21 05:15:59 +02:00
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
|
|
|
$phpgw->template->set_var("lang_last_x_logins",lang("Last x logins",$show_maxlog));
|
2000-08-21 05:15:59 +02:00
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_var("lang_loginid",lang("LoginID"));
|
|
|
|
$phpgw->template->set_var("lang_ip",lang("IP"));
|
|
|
|
$phpgw->template->set_var("lang_login",lang("Login"));
|
|
|
|
$phpgw->template->set_var("lang_logout",lang("Logout"));
|
|
|
|
$phpgw->template->set_var("lang_total",lang("Total"));
|
2000-08-21 05:15:59 +02:00
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->parse("out","header");
|
2000-08-18 05:24:22 +02:00
|
|
|
|
|
|
|
$phpgw->db->query("select loginid,ip,li,lo from access_log order by li desc "
|
|
|
|
. "limit $show_maxlog");
|
|
|
|
while ($phpgw->db->next_record()) {
|
2000-08-21 05:15:59 +02:00
|
|
|
|
2000-08-18 05:24:22 +02:00
|
|
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_var("tr_color",$tr_color);
|
2000-08-18 05:24:22 +02:00
|
|
|
|
|
|
|
// In case there was a problem creating there session. eg, bad login time
|
|
|
|
// I still want it to be printed here. This will alert the admin there
|
|
|
|
// is a problem.
|
|
|
|
if ($phpgw->db->f("li") && $phpgw->db->f("lo")) {
|
2000-11-06 12:38:22 +01:00
|
|
|
$total = ($phpgw->db->f("lo") - $phpgw->db->f("li"));
|
|
|
|
if ($total > 86400 && $total > 172800) {
|
2000-08-18 05:24:22 +02:00
|
|
|
$total = gmdate("z \d\a\y\s - G:i:s",$total);
|
2000-11-06 12:38:22 +01:00
|
|
|
} else if ($total > 172800) {
|
2000-08-18 05:24:22 +02:00
|
|
|
$total = gmdate("z \d\a\y - G:i:s",$total);
|
2000-11-06 12:38:22 +01:00
|
|
|
} else {
|
2000-08-18 05:24:22 +02:00
|
|
|
$total = gmdate("G:i:s",$total);
|
2000-11-06 12:38:22 +01:00
|
|
|
}
|
|
|
|
} else {
|
2000-08-18 05:24:22 +02:00
|
|
|
$total = " ";
|
2000-11-06 12:38:22 +01:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-11-06 12:38:22 +01:00
|
|
|
if ($phpgw->db->f("li")) {
|
2000-08-30 09:55:42 +02:00
|
|
|
$li = $phpgw->common->show_date($phpgw->db->f("li"));
|
2000-11-06 12:38:22 +01:00
|
|
|
} else {
|
2000-08-18 05:24:22 +02:00
|
|
|
$li = " ";
|
2000-11-06 12:38:22 +01:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-11-06 12:38:22 +01:00
|
|
|
if ($phpgw->db->f("lo") != '') {
|
2000-08-30 09:55:42 +02:00
|
|
|
$lo = $phpgw->common->show_date($phpgw->db->f("lo"));
|
2000-11-06 12:38:22 +01:00
|
|
|
} else {
|
2000-08-18 05:24:22 +02:00
|
|
|
$lo = " ";
|
2000-11-06 12:38:22 +01:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_var("row_loginid",$phpgw->db->f("loginid"));
|
|
|
|
$phpgw->template->set_var("row_ip",$phpgw->db->f("ip"));
|
|
|
|
$phpgw->template->set_var("row_li",$li);
|
|
|
|
$phpgw->template->set_var("row_lo",$lo);
|
|
|
|
$phpgw->template->set_var("row_total",$total);
|
2000-08-21 05:15:59 +02:00
|
|
|
|
2000-08-22 02:58:29 +02:00
|
|
|
if ($phpgw->db->num_rows() == 1) {
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_var("output","");
|
2000-08-22 02:58:29 +02:00
|
|
|
}
|
2000-08-21 05:15:59 +02:00
|
|
|
if ($phpgw->db->num_rows() != ++$i) {
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->parse("output","row",True);
|
2000-08-21 05:15:59 +02:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$phpgw->db->query("select count(*) from access_log");
|
|
|
|
$phpgw->db->next_record();
|
|
|
|
$total = $phpgw->db->f(0);
|
|
|
|
|
2000-11-15 10:34:57 +01:00
|
|
|
$phpgw->db->query("select count(*) from access_log where lo!=''");
|
2000-08-18 05:24:22 +02:00
|
|
|
$phpgw->db->next_record();
|
|
|
|
$loggedout = $phpgw->db->f(0);
|
|
|
|
|
|
|
|
$percent = round((10000 * ($loggedout / $total)) / 100);
|
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->set_var("bg_color",$phpgw_info["themes"]["bg_color"]);
|
|
|
|
$phpgw->template->set_var("footer_total",lang("Total records") . ": $total");
|
|
|
|
$phpgw->template->set_var("lang_percent",lang("Percent of users that logged out") . ": $percent%");
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-11-15 09:19:25 +01:00
|
|
|
$phpgw->template->pparse("out","footer");
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-09-29 07:24:18 +02:00
|
|
|
$phpgw->common->phpgw_footer();
|