PLease help

Started by actionman, November 24, 2012, 09:44:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

autotron

You could always post your announce, sometimes fresh eyes make all the difference in the world

actionman

Hi and thanks

yeah i have added everything, even in the config file

announce still works, just it doesnt run that code.
all i want to do is add a certain class to not have any more than 4 torrents

i dont have any syntax errors on the file or issues when its run - its like it skips that part lol
all DB queries are ok too

i will keep trying - worst thing i can do is start again from fresh on the announce...LOL

AM

cherwonk

#4
what exactly is it doing or not doing?
Does it not show in the profiles?
does it not limit the file amounts?
Does you announce still work after you add this?
Are you sure you've put in the other necessary code and DB entries for this? Its not just the announce.
You need these defined in the config file also,
Code (php) Select
$TBDEV['max_slots'] = 1; // 1=On 0=Off
$TBDEV['user_slots'] = 20;
$TBDEV['p_user_slots'] = 30;
$TBDEV['user_ratio1_slots'] = 2;
$TBDEV['user_ratio2_slots'] = 3;
$TBDEV['user_ratio3_slots'] = 5;
$TBDEV['user_ratio4_slots'] = 10;

I've found that the announce.php is a finicky file. Things need to be in just the right place in order for it to work.

actionman

Thanks for your reply - still a no for it doing this

i cant understand why

any other help would be appreciated

cherwonk

In the beginning of the announce (09 correct I hope)
Code (php) Select
////////////////// GLOBAL VARIABLES ////////////////////////////
$TBDEV['baseurl'] = '#baseurl';
$TBDEV['announce_interval'] = 60 * 30;
$TBDEV['connectable_check'] = 1;
$TBDEV['max_slots'] = 0; //1=On 0=Off
$TBDEV['user_slots'] = 20;
$TBDEV['p_user_slots'] = 30;
$TBDEV['user_ratio1_slots'] = 2;
$TBDEV['user_ratio2_slots'] = 9;
$TBDEV['user_ratio3_slots'] = 15;
$TBDEV['user_ratio4_slots'] = 100;
define('TIME_NOW', time());
define ('UC_USER', 0);
define ('UC_POWER_USER', 1);
define ('UC_EXTREME_USER', 2);
define ('UC_VIP', 3);
// DB setup

then further down at the beginning of the up/down stats
Code (php) Select
if (!isset($self))
{
$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" . sqlesc($passkey)));
if ($valid[0] >= 2 && $seeder == 'no') err("Connection limit exceeded! You may only leech from one location at a time.");
if ($valid[0] >= 3 && $seeder == 'yes') err("Connection limit exceeded!");
     $ratio = (($user["downloaded"] > 0) ? ($user["uploaded"] / $user["downloaded"]) : 1);
     if ($TBDEV['max_slots']) {
        if ($ratio < 0.95) {
        switch (true) {
        case ($ratio < 0.5):
        $max = $TBDEV['user_ratio1_slots'];
        break;
        case ($ratio < 0.65):
        $max = $TBDEV['user_ratio2_slots'];
        break;
        case ($ratio < 0.8):
        $max = $TBDEV['user_ratio3_slots'];
        break;
        case ($ratio < 0.95):
        $max = $TBDEV['user_ratio4_slots'];
        break;
        default:
           $max = $TBDEV['user_ratio1_slots'];
        }
         }
         else {
         switch ($user['class']) {
        case UC_USER:
        $max = $TBDEV['user_slots'];
        break;
        case UC_POWER_USER:
        $max = $TBDEV['p_user_slots'];
        break;
          $max = 99;
        }
         }
        if ($max > 0) {
            $res = mysql_query("SELECT COUNT(*) AS num FROM peers WHERE userid='$userid' AND seeder='no'") or err("Tracker error 5");
            $row = mysql_fetch_assoc($res);
           
            if ($row['num'] >= $max)
                err("Access denied (Torrents Limit exceeded - $max) See FAQ!");
        }
    }
}
else
{
$upthis = max(0, $uploaded - $self["uploaded"]);
$downthis = max(0, $downloaded - $self["downloaded"]);
  $upspeed = ($upthis > 0 ? $upthis / $self["announcetime"] : 0);
  $downspeed = ($downthis > 0 ? $downthis / $self["announcetime"] : 0);
  $announcetime = ($self["seeder"] == "yes" ? "seedtime = seedtime + $self[announcetime]" : "leechtime = leechtime + $self[announcetime]");
 


Try that see if it helps.

actionman

Hi guys

i do hope someone can help me here

I am trying to get my announce to do max slots - i have tried the code from pdq using just my class - added it too config etc etc but no joy it still downloads despite being more than what it is set at.

i have even tried this code

Code (php) Select
if ($left > 0 && $user['class'] == UC_CODER) {
// $wait = 24;
// $time = floor((time() - $torrent["ts"]) / 3600);
$valid1 = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE userid=".$userid." AND seeder = 'no' "));
if ($valid1[0] > 1)
err("Connection limit exceeded! You are only allowed to leech 1 torrents at a time.");
}


but even this doesnt work, does any one have any ideas as to why nothing i do in the announce.php works even the original wait times doesnt?? everything else is fine however - makes no sense

thanks

Actionman