Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
  #1  
Old 15th February 2009, 19:36
KustomizeR KustomizeR is offline
Senior Member
 
Join Date: May 2008
Posts: 26
Default [TBDev] User Promotions Log
Hello, has anyone the script that allows you to view the User Promotions in the log.php file of TBDev source?

It looks like this:

Code:
if (strpos($arr['txt'],'was promoted/demoted to XXX  by')) $color = "green";

thanks
Reply With Quote
  #2  
Old 16th February 2009, 17:38
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
PHP Code:
// promote power users
    
$maxdt sqlesc(get_date_time(gmtime() - $ap_time));
    
$res mysql_query("SELECT id FROM users WHERE class = ".UC_USER." AND uploaded >= $ap_limit AND uploaded / downloaded >= $ap_ratio AND added < $maxdt") or sqlerr(__FILE____LINE__);
    if (
mysql_num_rows($res) > 0)
    {
        
$dt sqlesc(get_date_time());
        
$msg sqlesc("Congratulations, you have been auto-promoted to [b]Power User[/b]. :)\n");
        while (
$arr mysql_fetch_assoc($res))
        {
            
mysql_query("UPDATE users SET class = ".UC_POWER_USER." WHERE id = $arr[id]") or sqlerr(__FILE____LINE__);
            
mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $arr[id]$dt$msg, 0)") or sqlerr(__FILE____LINE__);
        }
    }

    
// demote power users
    
$res mysql_query("SELECT id FROM users WHERE class = ".UC_POWER_USER." AND uploaded / downloaded < $ad_ratio") or sqlerr(__FILE____LINE__);
    if (
mysql_num_rows($res) > 0)
    {
        
$dt sqlesc(get_date_time());
        
$msg sqlesc("You have been auto-demoted from [b]Power User[/b] to [b]User[/b] because your share ratio has dropped below $ad_ratio.\n");
        while (
$arr mysql_fetch_assoc($res))
        {
            
mysql_query("UPDATE users SET class = ".UC_USER." WHERE id = $arr[id]") or sqlerr(__FILE____LINE__);
            
mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $arr[id]$dt$msg, 0)") or sqlerr(__FILE____LINE__);
        }
    } 
Reply With Quote
  #3  
Old 16th February 2009, 19:59
KustomizeR KustomizeR is offline
Senior Member
 
Join Date: May 2008
Posts: 26
Default
That is not correct! That is from cleanup.php and it`s the script that makes the rules about auto-promotions and it`s not showing anything in the log file
Reply With Quote
  #4  
Old 16th February 2009, 22:21
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
then get log.php otherwise sorry cant help you
Reply With Quote
  #5  
Old 21st March 2009, 18:01
KustomizeR KustomizeR is offline
Senior Member
 
Join Date: May 2008
Posts: 26
Default
The script should look like this:

Click the image to open in full size.
Reply With Quote
  #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
Reply

Tags
log , promotions , tbdev , user

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding new user class on tbdev 3v0 TBDev 3 10th January 2012 17:16
DATABASE: mysql_connect: Access denied for user 'user'@'localhost' ciolpalas Torrent Trader 2 30th June 2010 08:31
Bug in promoting user to power user in TS 5.6 crztz Template Shares 5 7th December 2009 03:58
New User bazboz Introduce Yourself 1 2nd April 2009 17:48
how change the normal user to power or admin user in ts TS Special Edition v.5.1 theway Template Shares 2 27th September 2008 14:44



All times are GMT +2. The time now is 14:48. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.