Thread: File manager
View Single Post
  #3  
Old 3rd January 2009, 23:59
Ginno Ginno is offline
Member
 
Join Date: Dec 2008
P2P
Posts: 13
Default
Code:
<?php
/*
// +--------------------------------------------------------------------------+
// | 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("<table border=1 cellspacing=0 width=605 cellpadding=5>\n");
print("<tr><td class=tabletitle align=left>Search Log</td></tr>\n");
print("<tr><td class=tableb align=left><form method=\"get\" action=searchlog.php>\n");
print("<input type=\"text\" name=\"query\" size=\"40\" value=\"" . htmlspecialchars($searchstr) . "\">\n");
print("<input type=submit value=" . SEARCH . " style='height: 20px' /></form>\n");
print("</td></tr></table>\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("<b>Log is empty</b>\n");
else
{

//echo $pagertop;

  print("<table border=1 cellspacing=0 cellpadding=5>\n");
  print("<tr><td class=tabletitle align=left>Date</td><td class=tabletitle align=left>Time</td><td class=tabletitle align=left>Event</td></tr>\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("<tr><td>$date</td><td>$time</td><td align=left></td></tr>\n");

    print("<tr class=tableb><td>$date</td><td>$time</td><td align=left><font color='".$color."'>".$arr['txt']."</font></td></tr>\n");
  }
  print("</table>");
}
echo $pagerbottom;

print("<p>Times are in GMT.</p>\n");

stdfoot();

?>
Reply With Quote