Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   problem with my tracker system (http://www.bvlist.com/showthread.php?t=9298)

Dote 14th July 2013 22:37

problem with my tracker system
 
Hi, i have problems with my TBDev system.
when people downloading to there seedbox/computer or trying to upload some torrents there are errors like:
"invaild hash_pass"
"invaild peer_id"
"finding peers"
and some more..
the torrents are also red and not seeding.
but its happened just in my tracker while every tracker else is good.

someone can help me please?

I'm using TBDev 2009 (final) rev 295

firefly007 14th July 2013 23:17

First check if magic quota's have been disabled in your php config file
(php.ini), this could be the reason why you are getting announce errors. Also, it might be a good idea to download http://forum.u-232.com/index.php?action=downloads and try it! if you aren't or ready. I have installed it on my Linux dedi server and it works perfectly.

x360zone 15th July 2013 08:35

hi
 
is this local host or shared hosting?

Dote 15th July 2013 11:01

Quote:

Originally Posted by firefly007 (Post 41607)
First check if magic quota's have been disabled in your php config file
(php.ini), this could be the reason why you are reason announce errors. Also, it might be a good idea to download http://forum.u-232.com/index.php?action=downloads and try it! if you aren't or ready. I have installed it on my Linux dedi server and it works perfectly.

i talk with the owner of the hosting and he said to me "No, its not a privet server".

Quote:

Originally Posted by x360zone (Post 41610)
is this local host or shared hosting?

shared hosting

x360zone 15th July 2013 11:50

hi
 
good luck there it probably wont work go vps or test another host

Dote 15th July 2013 21:15

I disabled magic quote's and it worked but now when i'm uploading torrent after a while it deleting all the torrent until torrent number 128 everytime!
is so weird and i cant find out the problem.

firefly007 15th July 2013 22:13

Quote:

Originally Posted by Dote (Post 41615)
I disabled magic quote's and it worked but now when i'm uploading torrent after a while it deleting all the torrent until torrent number 128 everytime!
is so weird and i cant find out the problem.

Backup cleanup.php in /include/ and replace with this

PHP Code:

<?php
/*
+------------------------------------------------
|   TBDev.net BitTorrent Tracker PHP
|   =============================================
|   by CoLdFuSiOn
|   (c) 2003 - 2009 TBDev.Net
|   http://www.tbdev.net
|   =============================================
|   svn: http://sourceforge.net/projects/tbdevnet/
|   Licence Info: GPL
+------------------------------------------------
|   $Date$
|   $Revision$
|   $Author$
|   $URL$
+------------------------------------------------
*/
require_once("bittorrent.php");

function 
deadtime() {
    global 
$TBDEV;
    return 
time() - floor($TBDEV['announce_interval'] * 1.3);
}

function 
docleanup() {
    global 
$TBDEV;

    
set_time_limit(0);
    
ignore_user_abort(1);

    do {
        
$res mysql_query("SELECT id FROM torrents");
        
$ar = array();
        while (
$row mysql_fetch_array($res,MYSQL_NUM)) {
            
$id $row[0];
            
$ar[$id] = 1;
        }

        if (!
count($ar))
            break;

        
$dp = @opendir($TBDEV['torrent_dir']);
        if (!
$dp)
            break;

        
$ar2 = array();
        while ((
$file readdir($dp)) !== false) {
            if (!
preg_match('/^(\d+)\.torrent$/'$file$m))
                continue;
            
$id $m[1];
            
$ar2[$id] = 1;
            if (isset(
$ar[$id]) && $ar[$id])
                continue;
            
$ff $TBDEV['torrent_dir'] . "/$file";
            
unlink($ff);
        }
        
closedir($dp);

        if (!
count($ar2))
            break;

        
$delids = array();
        foreach (
array_keys($ar) as $k) {
            if (isset(
$ar2[$k]) && $ar2[$k])
                continue;
            
$delids[] = $k;
            unset(
$ar[$k]);
        }
        if (
count($delids))
            
mysql_query("DELETE FROM torrents WHERE id IN (" join(","$delids) . ")");

        
$res mysql_query("SELECT torrent FROM peers GROUP BY torrent");
        
$delids = array();
        while (
$row mysql_fetch_array($res,MYSQL_NUM)) {
            
$id $row[0];
            if (isset(
$ar[$id]) && $ar[$id])
                continue;
            
$delids[] = $id;
        }
        if (
count($delids))
            
mysql_query("DELETE FROM peers WHERE torrent IN (" join(","$delids) . ")");

        
$res mysql_query("SELECT torrent FROM files GROUP BY torrent");
        
$delids = array();
        while (
$row mysql_fetch_array($res,MYSQL_NUM)) {
            
$id $row[0];
            if (isset(
$ar[$id]) && $ar[$id])
                continue;
            
$delids[] = $id;
        }
        if (
count($delids))
            
mysql_query("DELETE FROM files WHERE torrent IN (" join(","$delids) . ")");
    } while (
0);

    
$deadtime deadtime();
    @
mysql_query("DELETE FROM peers WHERE last_action < $deadtime");

    
$deadtime -= $TBDEV['max_dead_torrent_time'];
    @
mysql_query("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < $deadtime");

    
$deadtime time() - $TBDEV['signup_timeout'];
    @
mysql_query("DELETE FROM users WHERE status = 'pending' AND added < $deadtime AND last_login < $deadtime AND last_access < $deadtime");

    
$torrents = array();
    
$res = @mysql_query("SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder");
    while (
$row mysql_fetch_assoc($res)) {
        if (
$row["seeder"] == "yes")
            
$key "seeders";
        else
            
$key "leechers";
        
$torrents[$row["torrent"]][$key] = $row["c"];
    }

    
$res = @mysql_query("SELECT torrent, COUNT(*) AS c FROM comments GROUP BY torrent");
    while (
$row mysql_fetch_assoc($res)) {
        
$torrents[$row["torrent"]]["comments"] = $row["c"];
    }
    
    
    
$fields explode(":""comments:leechers:seeders");
    
$res = @mysql_query("SELECT id, seeders, leechers, comments FROM torrents");
    while (
$row mysql_fetch_assoc($res)) {
        
$id $row["id"];
        if(isset(
$torrents[$id]))
        
$torr $torrents[$id];
        foreach (
$fields as $field) {
            if (!isset(
$torr[$field]))
                
$torr[$field] = 0;
        }
        
$update = array();
        foreach (
$fields as $field) {
            if (
$torr[$field] != $row[$field])
                
$update[] = "$field = " $torr[$field];
        }
        if (
count($update))
            @
mysql_query("UPDATE torrents SET " implode(","$update) . " WHERE id = $id");
    }

    
//delete inactive user accounts
    
$secs 42*86400;
    
$dt = (time() - $secs);
    
$maxclass UC_POWER_USER;
    @
mysql_query("DELETE FROM users WHERE status='confirmed' AND class <= $maxclass AND last_access < $dt");

    
// lock topics where last post was made more than x days ago
/*    $secs = 7*86400;
    $res = mysql_query("SELECT topics.id FROM topics LEFT JOIN posts ON topics.lastpost = posts.id WHERE topics.locked = 'no' AND topics.sticky = 'no' AND " . gmtime() . " - UNIX_TIMESTAMP(posts.added) > $secs") or sqlerr(__FILE__, __LINE__);
  if(mysql_num_rows($res) > 0) {
    while ($arr = mysql_fetch_assoc($res))
    $pids[] = $arr['id'];
        mysql_query("UPDATE topics SET locked='yes' WHERE id IN (".join(',', $pids).")") or sqlerr(__FILE__, __LINE__);
  }
*/  
  //remove expired warnings
  
$res = @mysql_query("SELECT id FROM users WHERE warned='yes' AND warneduntil < ".time()." AND warneduntil <> 0") or sqlerr(__FILE____LINE__);
  if (
mysql_num_rows($res) > 0)
  {
    
$dt time();
    
$msg sqlesc("Your warning has been removed. Please keep in your best behaviour from now on.\n");
    while (
$arr mysql_fetch_assoc($res))
    {
      @
mysql_query("UPDATE users SET warned = 'no', warneduntil = 0 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__);
    }
  }

    
// promote power users
    
$limit 25*1024*1024*1024;
    
$minratio 1.05;
    
$maxdt = (time() - 86400*28);
    
$res = @mysql_query("SELECT id FROM users WHERE class = 0 AND uploaded >= $limit AND uploaded / downloaded >= $minratio AND added < $maxdt") or sqlerr(__FILE____LINE__);
    if (
mysql_num_rows($res) > 0)
    {
        
$dt time();
        
$msg sqlesc("Congratulations, you have been auto-promoted to [b]Power User[/b]. :)\nYou can now download dox over 1 meg and view torrent NFOs.\n");
        while (
$arr mysql_fetch_assoc($res))
        {
            @
mysql_query("UPDATE users SET class = 1 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
    
$minratio 0.95;
    
$res mysql_query("SELECT id FROM users WHERE class = 1 AND uploaded / downloaded < $minratio") or sqlerr(__FILE____LINE__);
    if (
mysql_num_rows($res) > 0)
    {
        
$dt time();
        
$msg sqlesc("You have been auto-demoted from [b]Power User[/b] to [b]User[/b] because your share ratio has dropped below $minratio.\n");
        while (
$arr mysql_fetch_assoc($res))
        {
            @
mysql_query("UPDATE users SET class = 0 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__);
        }
    }

    
// Update stats
    
$seeders get_row_count("peers""WHERE seeder='yes'");
    
$leechers get_row_count("peers""WHERE seeder='no'");
    @
mysql_query("UPDATE avps SET value_u=$seeders WHERE arg='seeders'") or sqlerr(__FILE____LINE__);
    @
mysql_query("UPDATE avps SET value_u=$leechers WHERE arg='leechers'") or sqlerr(__FILE____LINE__);

    
// update forum post/topic count
    //$forums = @mysql_query("SELECT t.forumid, count( DISTINCT p.topicid ) AS topics, count( * ) AS posts FROM posts p LEFT JOIN topics t ON t.id = p.topicid LEFT JOIN forums f ON f.id = t.forumid GROUP BY t.forumid");
    
$forums = @mysql_query("SELECT f.id, count( DISTINCT t.id ) AS topics, count( * ) AS posts
                          FROM forums f
                          LEFT JOIN topics t ON f.id = t.forumid
                          LEFT JOIN posts p ON t.id = p.topicid
                          GROUP BY f.id"
);
    while (
$forum mysql_fetch_assoc($forums))
    {
/*
        $postcount = 0;
        $topiccount = 0;
        $topics = mysql_query("select id from topics where forumid=$forum[id]");
        while ($topic = mysql_fetch_assoc($topics))
        {
            $res = mysql_query("select count(*) from posts where topicid=$topic[id]");
            $arr = mysql_fetch_row($res);
            $postcount += $arr[0];
            ++$topiccount;
        } */
        
$forum['posts'] = $forum['topics'] > $forum['posts'] : 0;
        @
mysql_query("update forums set postcount={$forum['posts']}, topiccount={$forum['topics']} where id={$forum['id']}");
    }

    
// delete old torrents
    /*$days = 28;
    $dt = (time() - ($days * 86400));
    $res = mysql_query("SELECT id, name FROM torrents WHERE added < $dt");
    while ($arr = mysql_fetch_assoc($res))
    {
        @unlink("{$TBDEV['torrent_dir']}/{$arr['id']}.torrent");
        @mysql_query("DELETE FROM torrents WHERE id={$arr['id']}");
        @mysql_query("DELETE FROM peers WHERE torrent={$arr['id']}");
        @mysql_query("DELETE FROM comments WHERE torrent={$arr['id']}");
        @mysql_query("DELETE FROM files WHERE torrent={$arr['id']}");
        write_log("Torrent {$arr['id']} ({$arr['name']}) was deleted by system (older than $days days)");
    }
*/
    // Remove expired readposts...
    
$dt = (time() - $TBDEV['readpost_expiry']);

    @
mysql_query("DELETE readposts FROM readposts ".
        
"LEFT JOIN posts ON readposts.lastpostread = posts.id ".
        
"WHERE posts.added < $dt") or sqlerr(__FILE__,__LINE__);

}

?>


Dote 17th July 2013 01:56

Quote:

Originally Posted by firefly007 (Post 41617)
Backup cleanup.php in /include/ and replace with this

Thanks alot everything works now!


All times are GMT +2. The time now is 09:56.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.