Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   FreeTSP (http://www.bvlist.com/forumdisplay.php?f=120)
-   -   Not connectable (http://www.bvlist.com/showthread.php?t=11138)

dreadbv 15th May 2017 18:41

Not connectable
 
Hello, I have FreeTSP bug fix edition.

I'm not sure what port to edit or what to change in announce.php so I appear connectable.
When I had the tracker on 000webhost it was working , but I moved it to my home PC and is running on xampp , and now I get not connectable.

So with that said, I can't upload anything, torrent software didn't even see me as seeder / peer , but on the website I can see 1 peer


Here is my announce.php

PHP Code:

<?php

/**
**************************
** FreeTSP Version: 1.0 **
**************************
** http://www.freetsp.info
** https://github.com/Krypto/FreeTSP
** Licence Info: GPL
** Copyright (C) 2010 FreeTSP v1.0
** A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
** Project Leaders: Krypto, Fireknight.
**/

require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR 'functions' DIRECTORY_SEPARATOR 'function_main.php');
require_once(
FUNC_DIR 'function_benc.php');
require_once(
FUNC_DIR 'function_vfunctions.php');

function 
err($msg)
{
    
benc_resp(array('failure reason' => array('type'  => 'string',
                                              
'value' => $msg)));
    exit();
}

function 
benc_resp($d)
{
    
benc_resp_raw(benc(array('type'  => 'dictionary',
                             
'value' => $d)));
}

function 
benc_resp_raw($x)
{
    
header("Content-Type: text/plain");
    
header("Pragma: no-cache");
    print(
$x);
}

foreach (array(
"passkey",
               
"info_hash",
               
"peer_id",
               
"ip",
               
"event")
            AS
            
$x)

{
    
$GLOBALS[$x] = ''.$_GET[$x];
}

foreach (array(
"port",
               
"downloaded",
               
"uploaded",
               
"left")
            AS
            
$x)

{
    
$GLOBALS[$x] = $_GET[$x];
}

if (
strpos($passkey"?"))
{
    
$tmp      substr($passkeystrpos($passkey"?"));
    
$passkey  substr($passkey0strpos($passkey"?"));
    
$tmpname  substr($tmp1strpos($tmp"=") - 1);
    
$tmpvalue substr($tmpstrpos($tmp"=") + 1);

    
$GLOBALS[$tmpname] = $tmpvalue;
}

foreach (array(
"passkey",
               
"info_hash",
               
"peer_id",
               
"port",
               
"downloaded",
               
"uploaded",
               
"left")
            AS
            
$x)

{
    if (!isset(
$x))
    {
        
err('Missing Key: $x');
    }
}

foreach (array(
"info_hash",
               
"peer_id")
            AS
            
$x)

{
    if (
strlen($GLOBALS[$x]) != 20)
    {
        
err("Invalid $x (" strlen($GLOBALS[$x]) . " - " urlencode($GLOBALS[$x]) . ")");
    }
}

if (
strlen($passkey) != 32)
{
    
err("Invalid Passkey (" strlen($passkey) . " - $passkey)");
}

$ip         getip();
$port       $port;
$downloaded $downloaded;
$uploaded   $uploaded;
$left       $left;
$rsize      50;

foreach (array(
"num want",
               
"numwant",
               
"num_want")
            AS
            
$k)
{
    if (isset(
$_GET[$k]))
    {
        
$rsize $_GET[$k];
        break;
    }
}

$agent $_SERVER['HTTP_USER_AGENT'];

//-- Deny Access Made With A Browser --//
if (
    
preg_match('%^Mozilla/|^Opera/|^Links |^Lynx/%i'$agent) ||
    isset(
$_SERVER['HTTP_COOKIE']) ||
    isset(
$_SERVER['HTTP_ACCEPT_LANGUAGE']) ||
    isset(
$_SERVER['HTTP_ACCEPT_CHARSET'])
    )
    
err("Sorry, this torrent is not Registered with $site_name");

if (!
$port || $port 0xffff)
{
    
err("Invalid Port");
}

if (!isset(
$event))
{
    
$event "";
}

$seeder = ($left == 0) ? "yes" "no";

db_connect();

$valid = @mysql_fetch_row(@sql_query("SELECT COUNT(id)
                                        FROM users
                                        WHERE passkey=" 
sqlesc($passkey)));

if (
$valid[0] != 1)
{
    
err("Invalid Passkey! Download the .torrent file again from $site_url");
}

$res sql_query("SELECT id, banned, seeders + leechers AS numpeers, UNIX_TIMESTAMP(added) AS ts, freeleech
                  FROM torrents
                  WHERE " 
hash_where("info_hash"$info_hash));

$torrent mysql_fetch_assoc($res);

if (!
$torrent)
{
    
err("Sorry, this torrent is not Registered with $site_name");
}

$torrentid $torrent['id'];

$fields "seeder, peer_id, ip, port, uploaded, downloaded, userid, (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_action)) AS announcetime";

$numpeers $torrent['numpeers'];
$limit    "";

if (
$numpeers $rsize)
{
    
$limit "ORDER BY RAND() LIMIT $rsize";
}

$res sql_query("SELECT $fields
                    FROM peers
                    WHERE torrent = 
$torrentid
                    AND connectable = 'yes' 
$limit");

$resp "d" benc_str("interval") . "i" $announce_interval "e" benc_str("peers") . "l";

unset(
$self);
while (
$row mysql_fetch_assoc($res))
{
    
$row['peer_id'] = hash_pad($row['peer_id']);

    if (
$row['peer_id'] === $peer_id)
    {
        
$userid $row['userid'];
        
$self   $row;
        continue;
    }

    
$resp .= "d" benc_str("ip") . benc_str($row['ip']) . benc_str("peer id") . benc_str($row['peer_id']) . benc_str("port") . "i" $row['port'] . "e" "e";
}

$resp .= "ee";

$selfwhere "torrent = $torrentid and " hash_where("peer_id"$peer_id);

if (!isset(
$self))
{
    
$res sql_query("SELECT $fields
                      FROM peers
                      WHERE 
$selfwhere");

    
$row mysql_fetch_assoc($res);

    if (
$row)
    {
        
$userid $row['userid'];
        
$self   $row;
    }
}

//-- Start of Upload & Download Stats --//

if (!isset($self))
{
    
/*
        $valid = @mysql_fetch_row(@sql_query("SELECT COUNT(id)
                                              FROM peers
                                              WHERE torrent = $torrentid
                                              AND passkey = " . sqlesc($passkey)));
    */

    
$valid = @mysql_fetch_row(@sql_query("SELECT COUNT(id)
                                          FROM peers
                                          WHERE torrent = 
$torrentid
                                          AND passkey = '" 
sqlesc($passkey) . "';"));

    if (
$valid[0] >= && $seeder == 'no')
    {
        
err("Connection Limit Exceeded! You may Only Leech from One Location at a time.");
    }

    if (
$valid[0] >= && $seeder == 'yes')
    {
        
err("Connection Limit Exceeded!");
    }

    
$rz sql_query("SELECT id, uploaded, downloaded, class, parked, downloadpos
                     FROM users
                     WHERE passkey = " 
sqlesc($passkey) . "
                     AND enabled = 'yes'
                     ORDER BY last_access DESC
                     LIMIT 1"
) or err("Tracker Error 2");

    if (
$members_only && mysql_num_rows($rz) == 0)
    {
        
err("Unknown Passkey. Please redownload the torrent from $site_url.");
    }

    
$az     mysql_fetch_assoc($rz);
    
$userid $az['id'];

    if (
$az['downloadpos'] == "no")
    {
        
err("Your Download Privilege Has Been Removed! Please Contact A Member Of Staff To Resolve This Problem.");
    }

    if (
$az['parked'] == "yes")
    {
        
err("Your Account is Parked! (Read the FAQ)");
    }

    global 
$max_class_wait;

    if (
$az['class'] <= $max_class_wait)
    {
        
$gigs    $az['uploaded'] / (1024 1024 1024);
        
$elapsed floor((gmtime() - $torrent['ts']) / 3600);
        
$ratio   = (($az['downloaded'] > 0) ? ($az['uploaded'] / $az['downloaded']) : 1);

        global 
$waittime$ratio_1$ratio_2$ratio_3$ratio_4$gigs_1$gigs_2$gigs_3$gigs_4$wait_1$wait_2$wait_3$wait_4;

        if (
$ratio $ratio_1 || $gigs $gigs_1)
        {
            
$wait $wait_1;
        }
        elseif (
$ratio $ratio_2 || $gigs $gigs_2)
        {
            
$wait $wait_2;
        }
        elseif (
$ratio $ratio_3 || $gigs $gigs_3)
        {
            
$wait $wait_3;
        }
        elseif (
$ratio $ratio_4 || $gigs $gigs_4)
        {
            
$wait $wait_4;
        }
        else
        {
            
$wait 0;
        }

        if ((
$elapsed $wait) && ($waittime == 'true'))
        {
            
err("Not Authorized (" . ($wait $elapsed) . "h) - READ THE FAQ!");
        }
    }
}
else
{
    global 
$torrents_allfree;

    
$freeleech    $torrent['freeleech'];
    
$upthis       max(0$uploaded $self['uploaded']);
    
$downthis     max(0$downloaded $self['downloaded']);
    
$upspeed      = ($upthis $upthis $self['announcetime'] : 0);
    
$downspeed    = ($downthis $downthis $self['announcetime'] : 0);
    
$announcetime = ($self['seeder'] == "yes" "seedtime = seedtime + {$self['announcetime']}"leechtime = leechtime + {$self['announcetime']}");

    if (
$freeleech == 'yes'$downthis 0;
    if (
$torrents_allfree == 'true'$downthis 0;

    if (
$upthis || $downthis 0)
    {
        
sql_query("UPDATE users
                   SET uploaded = uploaded + 
$upthis, downloaded = downloaded + $downthis
                   WHERE id = 
$userid") or err("Tracker error 3");
    }
}

//-- End of Upload & Download Stats --//

function portblacklisted($port)
{
    
//-- Direct Connect --//
    
if ($port >= 411 && $port <= 413)
    {
        return 
true;
    }

    
//-- BitTorrent --//
    
if ($port >= 6881 && $port <= 6889)
    {
        return 
true;
    }

    
//-- Kazaa --//
    
if ($port == 1214)
    {
        return 
true;
    }

    
//-- Gnutella --//
    
if ($port >= 6346 && $port <= 6347)
    {
        return 
true;
    }

    
//-- Emule --//
    
if ($port == 4662)
    {
        return 
true;
    }

    
//-- WinMX --//
    
if ($port == 6699)
    {
        return 
true;
    }

    return 
false;
}

if (
portblacklisted($port))
{
    
err("Port $port is Blacklisted.");
}
else
{
    
$sockres = @fsockopen($ip$port$errno$errstr5);

    if (!
$sockres)
    {
        
$connectable "no";
    }
    else
    {
        
$connectable "yes";
        @
fclose($sockres);
    }
}

$updateset = array();

if (isset(
$self) && $event == "stopped")
{
    
$seeder 'no';

    
sql_query("DELETE
               FROM peers
               WHERE 
$selfwhere") or err("D Err");

    if (
mysql_affected_rows())
    {
        
$updateset[] = ($self['seeder'] == "yes" "seeders = seeders - 1" "leechers = leechers - 1");

        
sql_query("UPDATE snatched
                   SET ip = " 
sqlesc($ip) . ", port = $port, connectable = '$connectable', uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, to_go = $left, upspeed = $upspeed, downspeed = $downspeed$announcetime, last_action = '" get_date_time() . "', seeder = '$seeder', agent = " sqlesc($agent) . "
                   WHERE torrentid = 
$torrentid
                   AND userid = 
$userid") or err("SL Err 1");
    }
}
elseif (isset(
$self))
{
    if (
$event == "completed")
    {
        
$updateset[] = "times_completed = times_completed + 1";
        
$finished    ", finishedat = UNIX_TIMESTAMP()";
        
$finished1   ", complete_date = '" get_date_time() . "'";
    }

    
sql_query("UPDATE peers
               SET ip = " 
sqlesc($ip) . ", port = $port, connectable = '$connectable', uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder', agent = " sqlesc($agent) . $finished
               WHERE 
$selfwhere") or err("PL Err 1");

    if (
mysql_affected_rows())
    {
        if (
$seeder <> $self['seeder'])
        {
            
$updateset[] = ($seeder == "yes" "seeders = seeders + 1, leechers = leechers - 1" "seeders = seeders - 1, leechers = leechers + 1");
        }

        
sql_query("UPDATE snatched
                   SET ip = " 
sqlesc($ip) . ", port = $port, connectable = '$connectable', uploaded = uploaded + $upthis, downloaded = downloaded + $downthis, to_go = $left, upspeed = $upspeed, downspeed = $downspeed$announcetime, last_action = '" get_date_time() . "', seeder = '$seeder', agent = " sqlesc($agent) . $finished1
                   WHERE torrentid = 
$torrentid
                   AND userid = 
$userid") or err("SL Err 2");
    }
}
else
{
    
sql_query("INSERT INTO peers (torrent, userid, peer_id, ip, port, connectable, uploaded, downloaded, to_go, started, last_action, seeder, agent, downloadoffset, uploadoffset, passkey)
               VALUES (
$torrentid$userid, " sqlesc($peer_id) . ", " sqlesc($ip) . ", $port, '$connectable', $uploaded$downloaded$left, NOW(), NOW(), '$seeder', " sqlesc($agent) . ", $downloaded$uploaded, " sqlesc(unesc($passkey)) . ")") or err("PL Err 2");

    if (
mysql_affected_rows())
    {
        
$updateset[] = ($seeder == "yes" "seeders = seeders + 1" "leechers = leechers + 1");

        
sql_query("UPDATE snatched
                   SET ip = " 
sqlesc($ip) . ", port = $port, connectable = '$connectable', to_go = $left, last_action = '" get_date_time() . "', seeder = '$seeder', agent = " sqlesc($agent) . "
                   WHERE torrentid = 
$torrentid
                   AND userid = 
$userid") or err("SL Err 3");

        if (!
mysql_affected_rows() && $seeder == "no")

        {
            
sql_query("INSERT INTO snatched (torrentid, userid, peer_id, ip, port, connectable, uploaded, downloaded, to_go, start_date, last_action, seeder, agent)
                       VALUES (
$torrentid$userid, " sqlesc($peer_id) . ", " sqlesc($ip) . ", $port, '$connectable', $uploaded$downloaded$left, '" get_date_time() . "', '" get_date_time() . "', '$seeder', " sqlesc($agent) . ")") or err("SL Err 4");
        }
    }
}

if (
$seeder == "yes")
{
    if (
$torrent['banned'] != "yes")
    {
        
$updateset[] = "visible = 'yes'";
    }
    
$updateset[] = "last_action = NOW()";
}

if (
count($updateset))
{
    
sql_query("UPDATE torrents
               SET " 
join(","$updateset) . "
               WHERE id = 
$torrentid");
}

benc_resp_raw($resp);

?>


fireknight 16th May 2017 13:13

You have it running on your pc using Xampp.
Is your site live ( can you access it from the internet, or is it just for you to test on )

I run it on my laptop using xampp, but because I live in Australia and you cannot run a server from home on a standard internet access.
It is only accessible by myself.
So I cannot test torrents.
Basically you cannot leach from yourself.

Have you allowed your torrent client access through your firewall / anti virus / opened the port etc etc.

The more information you can give.
The more we can eliminate possible problems.

What version Xampp.
OS / windows - mac / etc

Regards Fire.

dreadbv 16th May 2017 21:53

Hello,
Yes the tracker is live, It is accessible from anywhere .
Windows 10 pro(installed on a macbook air), xampp version 1.7.2 32bit, I used this old version because the tracker needs an older version of php to run without errors.

My torrent client has the port open, I seed a lot to other trackers , so no problem there.

Maybe that's the problem, trying to seed on my laptop and download on my PC , both are on same network, I did try to do it from work today, and the download did not start until I did a force reannounce on client, so something is working but not all the time. When I had the tracker on 000webhost the download started very fast, but with low speed , that's one of the reasons I wanted to move it to my home PC.

joeroberts 17th May 2017 01:37

Quote:

Originally Posted by dreadbv (Post 50212)
Hello,
both are on same network,

You can not seed to your self on the same network. you need to do it from 2 defrent locations.

dreadbv 18th May 2017 19:28

I did some testing with a friend and the upload/download won't start, do I have to seed from the laptop where I also have the tracker installed, can't I seed from a different PC in my network?

fireknight 19th May 2017 12:54

I am running FreeTSP V1 bug fix on my laptop.
I am using ApacheFriends XAMPP Version 5.6.30.
I have turned the error notices off.

Using utorrent I have uploaded a test torrent and everything is fine.
It is showing me as seeding.
It is showing me as connectable.

So I uploaded the torrent on my localhost test site, using utorrent.
I then logged out - then logged back in using a test account.

I downloaded the torrent using a different client ( quite an old one )
Bit Tornado

I directed the path of the torrent to a different empty folder.

It downloaded fine.
And now both accounts are showing as seeders.

Fireknight is showing as conectable.
Test account is showing as none conectable.
Chances are I have not opened the port for bit tornado.

XGODY 19th May 2017 13:28

I would like to run site front laptop but with msqli fire can you point me to where to do this first time for me to try this out as I've used live servers to do my work

iforgot 23rd May 2017 00:58

Quote:

Originally Posted by XGODY (Post 50228)
I would like to run site front laptop but with msqli fire can you point me to where to do this first time for me to try this out as I've used live servers to do my work

The school holidays aren't until next week. :wallbash:


All times are GMT +2. The time now is 12:04.

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