View Single Post
  #6  
Old 21st March 2009, 20:52
Undefined Undefined is offline
Senior Member
 
Join Date: Jan 2009
Default
Posts: 27
Default
that pic is from tbdev installer and the code is from musicmania originally

PHP Code:
CREATE TABLE `sitelog` (
  `
idint(10unsigned NOT NULL auto_increment,
  `
typenum('torrentupload','torrentedit','torrentdelete','promotion','demotion','addwarn','remwarn','accenabled','accdisabled','accdeleted','waitgrant','waitreject','passkeyreset','torrentgranted','autoclean','autowarn','autodewarn','autoban'collate utf8_bin NOT NULL default 'torrentupload',
  `
addeddatetime default NULL,
  `
txttext,
  
PRIMARY KEY  (`id`),
  
KEY `added` (`added`)
ENGINE=MyISAM 
PHP Code:
function write_log($typ$text)
{
   
$typ sqlesc($typ);
   
$text sqlesc($text);
   
$added sqlesc(get_date_time());
   
sql_query("INSERT INTO `sitelog` (`typ`, `added`, `txt`) VALUES($typ$added$text)") or sqlerr(__FILE____LINE__);

PHP Code:
<?php
require ("include/bittorrent.php");
require_once(
"include/user_functions.php");
require_once(
"include/bbcode_functions.php");
dbconn(false);
maxcoder();
if(!
logged_in())
{
header("HTTP/1.0 404 Not Found");
// moddifed logginorreturn by retro//Remember to change the following line to match your server
print("<html><h1>Not Found</h1><p>The requested URL /{$_SERVER['PHP_SELF']} was not found on this server.</p><hr /><address>Apache/1.1.11 (xxxxx) Server at ".$_SERVER['SERVER_NAME']." Port 80</address></body></html>\n");
die();
}

function 
puke($text "w00t")
{
    
stderr("w00t"$text);
}

if (
get_user_class() < UC_MODERATOR)
stderr("Error""Permission denied!");

function 
get_typ_name($typ)
{
    switch (
$typ) {
        case 
"torrentupload": return "Torrent uploaded";
        case 
"torrentedit": return "Torrent Edited";
        case 
"torrentdelete": return "Torrent Delete";
        case 
"autowarn": return "System Warnings";
        case 
"autodewarn": return "System Warnings Removed";
        case 
"autoban": return "System Ban  - Because of Bad Ratio";
        case 
"promotion": return "Promotion";
        case 
"demotion": return "Demotion";
        case 
"addwarn": return "Warning issued";
        case 
"remwarn": return "Warning removed";
        case 
"accenabled": return "Account Enabled";
        case 
"accdisabled": return "Account Disabled";
        case 
"accdeleted": return "Account deleted";
        case 
"passkeyreset": return "Passkey resets";
        case 
"autoclean": return "Auto cleanups";
        case 
"happyhour": return "Happy hours";
    }
}

$timerange = array(3600 => "1 Hour",
    
3600 => "3 Hours",
    
3600 => "6 Hours",
    
3600 => "9 Hours",
    
12 3600 => "12 Hours",
    
18 3600 => "18 Hours",
    
24 3600 => "1 Day",
    
24 3600 => "2 Days",
    
24 3600 => "3 Days",
    
24 3600 => "4 Days",
    
24 3600 => "5 Days",
    
24 3600 => "6 Days",
    
24 3600 => "1 Week",
    
14 24 3600 => "2 Weeks"
    
);

$types = array('torrentupload''torrentedit''torrentdelete''promotion''demotion''addwarn''remwarn''accenabled''accdisabled''accdeleted''passkeyreset''autoclean''happyhour''autowarn''autodewarn''autoban');
// Delete log items older than two weeks
$secs 14 24 3600;
stdhead("Site log");
sql_query("DELETE FROM sitelog2 WHERE " time() . " - UNIX_TIMESTAMP(added) > $secs") or sqlerr(__FILE____LINE__);
$where "WHERE ";
$typelist = Array();

if (isset(
$_GET["types"])) {
    foreach (
$_GET["types"] as $type) {
        
$typelist[] = sqlesc($type);
    }
    
$where .= "typ IN (" implode(","$typelist) . ") AND ";
}

if (isset(
$_GET["timerange"]))
    
$where .= time() . "-UNIX_TIMESTAMP(added)<" intval($_GET["timerange"]);
else {
    
$where .= time() . " - UNIX_TIMESTAMP(added) < 432000";
    
$_GET["timerange"] = 432000;
}

echo(
"<form action=\"log2.php\" method=\"get\"><a name=\"log\"></a><center>");
begin_table();
echo(
"<tr>\n");
$I 0;

foreach (
$types as $type) {
if (
$I == 4) {
    
$I 0;
        echo(
"</tr><tr>\n");
}
echo(
"<td class=\"tablea\"><input type=\"checkbox\" name=\"types[]\" value=\"$type\"");
if (
in_array(sqlesc($type), $typelist))
    echo(
" checked=checked");

    echo(
"> <a href=\"log2.php?timerange=" intval($_GET["timerange"]) . "&amp;types[]=$type&amp;filter=1#log\">" get_typ_name($type) . "</a></td>\n");
    
$I++;
}

if (
$I 4)
    echo 
"<td colspan=\"" . ($I) . "\"  class=\"tablea\">&nbsp;</td>\n";
    echo(
"</tr><tr><td class=\"tablea\" align=\"center\"><a href=\"log2.php?timerange=" intval($_GET["timerange"]) . "&amp;filter=1#log\">Show all</a></td><td class=\"tablea\" colspan=\"2\" align=\"center\">Time: <select name=\"timerange\" size=\"1\">\n");
foreach (
$timerange as $range => $desc) {
    echo 
"<option value=\"$range\"";
if (
intval($_GET["timerange"]) == $range)
    echo 
" selected=\"selected\"";
    echo 
">$desc</option>\n";
}

echo(
"</select></td><td class=\"tablea\" align=\"center\"><input type=\"submit\" name=\"filter\" value=\"Filters\"></td></tr></table></form><br>");

if (isset(
$_GET["filter"])) {
    
$res sql_query("SELECT typ, added, txt FROM sitelog2 $where ORDER BY added DESC") or sqlerr(__FILE____LINE__);

    if (
mysql_num_rows($res) == 0)
        echo(
"<b>There are no events with the desired types.</b>\n");
    else {
        echo(
"<b>There were " mysql_num_rows($res) . " Events with the desired types.</b>\n");
        
begin_table(true);
        echo(
"<tr><td class=tablecat align=left>Date</td><td class=tablecat align=left>Time</td><td class=tablecat align=left>Type</td><td class=tablecat align=left>Event</td></tr>\n");
        while (
$arr mysql_fetch_assoc($res)) {
            
$typ get_typ_name($arr["typ"]);
            
$date substr($arr['added'], 0strpos($arr['added'], " "));
            
$time substr($arr['added'], strpos($arr['added'], " ") + 1);
            echo(
"<tr><td class=tableb>$date</td><td class=tablea>$time</td><td class=tableb align=left nowrap=nowrap>$typ</td><td class=tablea align=left>$arr[txt]</td></tr>\n");
        }
        echo(
"</table>");
    }
    echo(
"<p>All times are local.</p>\n");
}
end_frame();
stdfoot();

?>
found this - change all log2 to log and ALL your write log entrys to match this :nosepick:
I hope i didn't forget anything...

Big job mate but ask here if u need help !

Oh yeah and change example if u have this in takeupload
write_log("Torrent $id ($torrent) was uploaded by $CURUSER[username]");
change it to like this
write_log("torrentupload", "Torrent $id ($torrent) was uploaded by $CURUSER[username]");

ext. I hope u get the idea...

Last edited by Undefined; 21st March 2009 at 21:20. Reason: add stuff
Reply With Quote