Ginno |
3rd January 2009 23:59 |
Code:
/*
// +--------------------------------------------------------------------------+
// | Project: FTS - Free Torrent Source |
// +--------------------------------------------------------------------------+
// | Module: log.php - View site's activity. |
// | Version: 1.4 |
// +--------------------------------------------------------------------------+
// | This file is part of FTS. Fts is based on TBDev, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// | |
// | FTS 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. |
// | |
// | FTS is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with FTS; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------------+
// | FTS IS FREE SOFTWARE, but it still can contain some encoded files. |
// +--------------------------------------------------------------------------+
// | Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Sorry", "Access denied.");
// delete items older than a week
$secs = 24 * 60 * 60;
stdhead("Site log");
mysql_query("DELETE FROM sitelog WHERE " . gmtime() . " - UNIX_TIMESTAMP(added) > $secs") or sqlerr(__FILE__, __LINE__);
print("\n");
print("Search Log | \n");
print("\n");
print(" | \n");
$res = mysql_query("SELECT COUNT(*) FROM sitelog");
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 20;
list($pagertop, $pagerbottom, $limit) = pager(50, $count, "log.php?");
$res = mysql_query("SELECT added, txt FROM sitelog ORDER BY added DESC $limit") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("Log is empty\n");
else
{
//echo $pagertop;
print("\n");
print("Date | Time | Event | \n");
while ($arr = mysql_fetch_assoc($res))
{
$color = 'black';
if (strpos($arr['txt'],'was uploaded by')) $color = "green";
if (strpos($arr['txt'],'was deleted by')) $color = "red";
if (strpos($arr['txt'],'was added to the Request section')) $color = "purple";
if (strpos($arr['txt'],'was edited by')) $color = "blue";
$date = substr($arr['added'], 0, strpos($arr['added'], " "));
$time = substr($arr['added'], strpos($arr['added'], " ") + 1);
// print("$date | $time | | \n");
print("$date | $time | ".$arr['txt']." | \n");
}
print(" ");
}
echo $pagerbottom;
print("Times are in GMT. \n");
stdfoot();
?>
|