Bravo List
Register
Go Back   > Bravo List > Source Code > Trackers > FreeTSP
Reply
  #21  
Old 28-11-12, 11:57
firefly's Avatar
firefly firefly is offline
Senior Member
 
Join Date: Dec 2009
P2P
Posts: 74
Default
Quote:
Originally Posted by Joco1114 View Post
I'm from Hungary. I had to change all HTMLEntities() to HTMLSpecialChars() because of accented chars. I got strange chars instead of my Hungarian chars.

Language files would be welcomed. :) I will translate it to Hungarian, if you will publish it.

Other: I "extended" this source with the HTTP download possibility. It means above a special ratio and/or for higher classes the members can download the files with HTTP protocol. I insertet into the function_config.php a new config variable:
PHP Code:
$http_upload_dir    ROOT_DIR."/tracker"
I seed my files from this folder by default and after a file_exists() inquiry I write the link for this file. Not too elegant, but I had no change torrent table with a new HTTP_URL field. :)

Other: I'm noticed an interesting thing: every leeching will start a couple of minutes after dropping into the client. It is about 4-5 minutes and the speed is not to good, about 1Mbit/sec (120kBps). Of course my inet speed is higher (20Mbits). I checked the wait time, but it is equal is 0 (for everyone). Or is there any limit of down speed in announce.php?

Sorry about my English, I learned everything from the Internet. So I speak BASIC English. :)
NIce job!

I seemed to get decent speed will test it later... I'm still doing the lang mod.

It would be a great help if you could translate this so long :)

PHP Code:
<?php
/* 
------------------
Language: English
------------------
*/

$lang = array();





// headers
$lang['new_member'] = 'Welcome our newest Member';
$lang['staff_news'] = 'Staff news page';
$lang['recent_news'] = 'Recent News';
$lang['poll'] = 'Site Polls';
$lang['top_poster'] = 'Top ten with posters';
$lang['top_ten'] = 'Top ten torrents downloaded';
$lang['recomended'] = 'Recommended torrents by staff';
$lang['top_forum'] = 'Top ten forum posts';
$lang['shoutbox'] = 'Shoutbox';
$lang['modbox'] = 'Mod Shoutbox';
$lang['radio'] = 'Site radio';
$lang['stats'] = 'Site stats';
$lang['last_online'] = 'Last people on the site';
$lang['disc'] = 'Sites Disclaimer';
$lang['load'] = 'Server load and stats';

//radio
$lang['rad_link'] = 'Radio Links';
$lang['rad_req'] = 'Radio requests';
$lang['view_req'] = 'View requests';
$lang['make_req'] = 'Make requests';
$lang['rad_stat'] = 'Radio stats';

//stats

$lang['reg_use'] = 'Registered Users';
$lang['uncon_user'] = 'Unconfirmed Users';
$lang['forum_top'] = 'Forum Topics';
$lang['forum_pos'] = 'Forum Posts';
$lang['peers'] = 'peers';
$lang['seeders'] = 'Seeders';
$lang['leecher'] = 'Leechers';
$lang['users_online'] = 'Users Online';
$lang['donors'] = 'Donors';
$lang['torrents'] = 'Torrents';
$lang['new_today'] = 'Torrents added today';
$lang['uncon'] = 'Unconnectable Peers';
$lang['uncon_rat'] = 'Unconnectables Ratio (%)';
$lang['seed_leech'] = 'Seeder/Leecher Ratio (%)';
$lang['lastten_online_head'] = 'The last ten visitors';
$lang['disc1'] = '<b>None of the files shown here are actually hosted on this server. The links are provided solely by this sites users.  The administrator of this site ';
$lang['disc2'] = 'cannot be held responsible for what its users post, or any other actions of its users.  You may not use this site to distribute or download any material when you do not have the legal rights to do so.  It is your own responsibility to adhere to these terms.</b>';
$lang['our_load'] = 'Our Tracker Load:';
$lang['load_txt1'] = '(these stats are an approximation)';
$lang['load_txt2'] = 'Global Server Load (All websites on current host servers):';
            

?>
and call it lang.hu.php
__________________
Can install Gazelle
Reply With Quote
  #22  
Old 28-11-12, 18:56
Joco1114's Avatar
Joco1114 Joco1114 is offline
Member
 
Join Date: Nov 2012
P2P
Posts: 6
Default
Sent by a PM.

J


Quote:
Originally Posted by firefly View Post
NIce job!
I seemed to get decent speed will test it later... I'm still doing the lang mod.
It would be a great help if you could translate this so long :)
Reply With Quote
  #23  
Old 25-12-12, 15:14
ExtremeGaby's Avatar
ExtremeGaby ExtremeGaby is offline
Banned
 
Join Date: Aug 2011
P2P
Posts: 1
Default
Quote:
Originally Posted by Tones View Post
Thanks man I will try to see how it works back after to tell how it goes!!

DHT works without problems if there is a problem along'll let you know!

But until then here's what appears on the home page

Warning: exec() has been disabled for security reasons in /home/u899582385/public_html/index.php on line 736

Our Tracker Load: (0 %)(these stats are an approximation)


Warning: exec() has been disabled for security reasons in /home/u899582385/public_html/index.php on line 744


Warning: exec() has been disabled for security reasons in /home/u899582385/public_html/index.php on line 747


Have you any suggestions???




Look at this ...

Click the image to open in full size.

poftim modul de takeupload.php sa vada 1 seeders

PHP Code:
<?php

/*
*-------------------------------------------------------------------------------*
*----------------    |  ____|        |__   __/ ____|  __ \        --------------*
*----------------    | |__ _ __ ___  ___| | | (___ | |__) |       --------------*
*----------------    |  __| '__/ _ \/ _ \ |  \___ \|  ___/        --------------*
*----------------    | |  | | |  __/  __/ |  ____) | |            --------------*
*----------------    |_|  |_|  \___|\___|_| |_____/|_|            --------------*
*-------------------------------------------------------------------------------*
*---------------------------    FreeTSP RC 3.0   -------------------------------*
*-------------------   The Alternate BitTorrent Source   -----------------------*
*-------------------------------------------------------------------------------*
*-------------------------------------------------------------------------------*
*--   This program is free software; you can redistribute it and/or modify    --*
*--   it under the terms of the GNU General Public License as published by    --*
*--   the Free Software Foundation; either version 2 of the License, or       --*
*--   (at your option) any later version.                                     --*
*--                                                                           --*
*--   This program is distributed in the hope that it will be useful,         --*
*--   but WITHOUT ANY WARRANTY; without even the implied warranty of          --*
*--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           --*
*--   GNU General Public License for more details.                            --*
*--                                                                           --*
*--   You should have received a copy of the GNU General Public License       --*
*--   along with this program; if not, write to the Free Software             --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  --*
*--                                                                           --*
*-------------------------------------------------------------------------------*
*------------   Original Credits to tbSource, Bytemonsoon, TBDev   -------------*
*-------------------------------------------------------------------------------*
*--------           Developed By: Krypto, Fireknight, Subzero           --------*
*-------------------------------------------------------------------------------*
*-----------------       First Release Date August 2010      -------------------*
*-----------                 http://www.freetsp.info                 -----------*
*------                    2010 FreeTSP Development Team                  ------*
*-------------------------------------------------------------------------------*
*/

require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'functions'.DIRECTORY_SEPARATOR.'function_main.php');
require_once(
INCL_DIR.'function_user.php');
require_once(
INCL_DIR.'function_vfunctions.php');
require_once(
INCL_DIR.'function_torrenttable.php');
require_once(
INCL_DIR.'function_benc.php');
require_once(
INCL_DIR.'function_page_verify.php');

ini_set("upload_max_filesize",$max_torrent_size);

db_connect();
logged_in();

$newpage = new page_verify();
$newpage->check('_upload_');

if (
get_user_class() < UC_USER)
    die;

foreach(
explode(":","descr:type:name") AS $v) {
    if (!isset(
$_POST[$v]))
        
error_message("error","Upload Failed!","Missing Form Data");
}

if (!isset(
$_FILES["file"]))
    
error_message("error","Upload Failed!","Missing Form Data");

$f     $_FILES["file"];
$fname unesc($f["name"]);

if (empty(
$fname))
{
    
error_message("error","Upload Failed!","Empty filename!");
}

$nfo sqlesc('');

if(isset(
$_FILES['nfo']) && !empty($_FILES['nfo']['name']))
{
    
$nfofile $_FILES['nfo'];

    if (
$nfofile['name'] == '')
        
error_message("error","Upload Failed!","No NFO!");

    if (
$nfofile['size'] == 0)
        
error_message("error","Upload Failed!","0-byte NFO");

    if (
$nfofile['size'] > 65535)
        
error_message("error","Upload Failed!","NFO is too big! Max 65,535 bytes.");

    
$nfofilename $nfofile['tmp_name'];

    if (@!
is_uploaded_file($nfofilename))
        
error_message("error","Upload Failed!","NFO Upload Failed");

    
$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));
}

$descr unesc($_POST["descr"]);

$tube unesc($_POST["tube"]);

if (!
$descr)
{
    
error_message("error","Upload Failed!","You must enter a Description!");
}

$catid = ($_POST["type"]);

if (!
is_valid_id($catid))
{
    
error_message("error","Upload Failed!","You must select a Category to put the torrent in!");
}

if (!
validfilename($fname))
{
    
error_message("error","Upload Failed!","Invalid Filename!");
}

if (!
preg_match('/^(.+)\.torrent$/si'$fname$matches))
{
    
error_message("error","Upload Failed!","Invalid Filename (Not a .torrent).");
}

$shortfname $torrent $matches[1];

if (!empty(
$_POST["name"]))
{
    
$torrent unesc($_POST["name"]);
}

if (!empty(
$_POST["poster"]))
{
     
$poster unesc($_POST["poster"]);
}

$tmpname $f["tmp_name"];

if (!
is_uploaded_file($tmpname))
{
    
error_message("error","Upload Failed!","eek");
}

if (!
filesize($tmpname))
{
    
error_message("error","Upload Failed!","Empty file!");
}

$dict bdec_file($tmpname$max_torrent_size);

if (!isset(
$dict))
{
    
error_message("error","Upload Failed!","What the hell did you upload? This is not a bencoded file!");
}

function 
dict_check($d$s)
{
    if (
$d["type"] != "dictionary")
    {
        
error_message("error","Upload Failed","not a dictionary");
    }

    
$a   explode(":"$s);
    
$dd  $d["value"];
    
$ret = array();
    
$t   '';

    foreach (
$a AS $k)
    {
        unset(
$t);

        if (
preg_match('/^(.*)\((.*)\)$/'$k$m))
        {
            
$k $m[1];
            
$t $m[2];
        }

        if (!isset(
$dd[$k]))
        {
            
error_message("error","Upload Failed!","Dictionary is missing Key(s)");
        }

        if (isset(
$t))
        {
            if (
$dd[$k]["type"] != $t)
            {
                
error_message("error","Upload Failed!","Invalid entry in Dictionary");
            }
            
$ret[] = $dd[$k]["value"];
        }
        else
        {
            
$ret[] = $dd[$k];
        }
    }
    return 
$ret;
}

function 
dict_get($d$k$t)
{
    if (
$d["type"] != "dictionary")
    {
        
error_message("error","Upload Failed!","Not a Dictionary");
    }

    
$dd $d["value"];

    if (!isset(
$dd[$k]))
    {
        return;
    }

    
$v $dd[$k];

    if (
$v["type"] != $t)
    {
        
error_message("error","Upload Failed!","Invalid Dictionary entry type");
    }
    return 
$v["value"];
}

list(
$ann$info) = dict_check($dict"announce(string):info");
list(
$dname$plen$pieces) = dict_check($info"name(string):piece length(integer):pieces(string)");

$passkey=$announce_urls[0].'?passkey='.$CURUSER['passkey'];

//if ($passkey != $ann)
//    error_message("error","Upload Failed!","Invalid Announce URL! must be <b>" . $announce_urls[0] . "</b>");

if (strlen($pieces) % 20 != 0)
{
    
error_message("error","Upload Failed!","Invalid Pieces");
}

$filelist = array();
$totallen dict_get($info"length""integer");

if (isset(
$totallen))
{
    
$filelist[] = array($dname$totallen);
    
$type "single";
}
else
{
    
$flist dict_get($info"files""list");

    if (!isset(
$flist))
    {
        
error_message("error","Upload Failed!","missing both length and files");
    }

    if (!
count($flist))
    {
        
error_message("error","Upload Failed!","No Files");
    }

    
$totallen 0;

    foreach (
$flist AS $fn)
    {
        list(
$ll$ff) = dict_check($fn"length(integer):path(list)");
        
$totallen += $ll;
        
$ffa = array();
        foreach (
$ff AS $ffe)
        {
            if (
$ffe["type"] != "string")
            {
                
error_message("error","Upload Failed!","Filename Error");
            }

            
$ffa[] = $ffe["value"];
        }

        if (!
count($ffa))
        {
            
error_message("error","Upload Failed!","Filename Error");
        }

        
$ffe implode("/"$ffa);
        
$filelist[] = array($ffe$ll);
    }
    
$type "multi";
}

$infohash pack("H*"sha1($info["string"]));

// Replace punctuation characters with spaces

$torrent str_replace("_"" "$torrent);
$torrent str_replace(".torrent"" "$torrent);
$torrent str_replace(".rar"" "$torrent);
$torrent str_replace(".avi"" "$torrent);
$torrent str_replace(".mpeg"" "$torrent);
$torrent str_replace(".exe"" "$torrent);
$torrent str_replace(".zip"" "$torrent);
$torrent str_replace(".wmv"" "$torrent);
$torrent str_replace(".iso"" "$torrent);
$torrent str_replace(".bin"" "$torrent);
$torrent str_replace(".txt"" "$torrent);
$torrent str_replace(".nfo"" "$torrent);
$torrent str_replace(".7z"" "$torrent);
$torrent str_replace(".mp3"" "$torrent);
$torrent str_replace("."" "$torrent);

$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));

$ret sql_query("INSERT INTO torrents (search_text, filename, owner, visible, tube, info_hash, name, size, numfiles, type, descr, ori_descr, category, save_as, added, last_action, nfo, poster) VALUES (" .
        
implode(","array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname$CURUSER["id"], "no"$tube,
 
$infohash$torrent$totallencount($filelist), $type$descr$descr$_POST["type"], $dname))) . ", '" get_date_time() . "', '" get_date_time() . "', $nfo, '".$poster."'
)"
);

if (!
$ret)
{
    if (
mysql_errno() == 1062)
    {
        
error_message("error","Upload Failed!","torrent already uploaded!");
    }
    
mysql_err();
}

$id mysql_insert_id();

@
sql_query("DELETE FROM files WHERE torrent = $id");

foreach (
$filelist AS $file)
{
    @
sql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
}

move_uploaded_file($tmpname"$torrent_dir/$id.torrent");

write_log("Torrent $id ($torrent) was uploaded by " $CURUSER["username"]);

/* RSS feeds */

if (($fd1 = @fopen("rss.xml""w")) && ($fd2 fopen("rssdd.xml""w")))
{
    
$cats "";
    
$res  sql_query("SELECT id, name FROM categories");

    while (
$arr mysql_fetch_assoc($res))
    {
        
$cats[$arr["id"]] = $arr["name"];
    }

    
$s "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" .
        
"<title>$site_name</title>\n<description>0-week torrents</description>\n<link>$site_url/</link>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);

    
$r sql_query("SELECT id,name,descr,filename,category FROM torrents ORDER BY added DESC LIMIT 15") OR sqlerr(__FILE____LINE__);

    while (
$a mysql_fetch_assoc($r))
    {
        
$cat $cats[$a["category"]];

        
$s   "<item>\n<title>" htmlspecialchars($a["name"] . " ($cat)") . "</title>\n" "<description>" htmlspecialchars($a["descr"]) . "</description>\n";

        @
fwrite($fd1$s);
        @
fwrite($fd2$s);
        @
fwrite($fd1"<link>$site_url/details.php?id=$a[id]&amp;hit=1</link>\n</item>\n");
        
$filename htmlspecialchars($a["filename"]);
        @
fwrite($fd2"<link>$site_url/download.php/$a[id]/$filename</link>\n</item>\n");
    }
    
$s "</channel>\n</rss>\n";

    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    @
fclose($fd1);
    @
fclose($fd2);
}

/* Email notifs

$res = sql_query("SELECT name FROM categories WHERE id=$catid") OR sqlerr();
$arr = mysql_fetch_assoc($res);
$cat = $arr["name"];
$res = sql_query("SELECT email FROM users WHERE enabled='yes' AND notifs LIKE '%[cat$catid]%'") OR sqlerr();
$uploader = $CURUSER['username'];

$size = mksize($totallen);
$description = ($html ? strip_tags($descr) : $descr);

$body = <<<EOD
A new torrent has been uploaded.

Name: $torrent
Size: $size
Category: $cat
Uploaded by: $uploader

Description
-------------------------------------------------------------------------------
$description
-------------------------------------------------------------------------------

You can use the URL below to download the torrent (you may have to login).

$site_url/details.php?id=$id&hit=1

--
$site_name
EOD;
$to = "";
$nmax = 100; // Max recipients per message
$nthis = 0;
$ntotal = 0;
$total = mysql_num_rows($res);
while ($arr = mysql_fetch_row($res))
{
    if ($nthis == 0)
    {
        $to = $arr[0];
    }
    else
    {
        $to .= "," . $arr[0];
    }
    ++$nthis;
    ++$ntotal;
    if ($nthis == $nmax || $ntotal == $total)
    {
        if (!mail("Multiple recipients <$site_email>", "New torrent - $torrent", $body,
            "From: $site_email\r\nBcc: $to", "-f$site_email"))
        {
            "error","Signup Failed!",("error","Error", "Your torrent has been been uploaded. DO NOT RELOAD THE PAGE!\n" .
                    "There was however a problem delivering the e-mail notifcations.\n" .
                    "Please let an administrator know about this error!\n");
        }
        $nthis = 0;
    }
}
*/

mysql_query("UPDATE torrents SET visible = 'yes' WHERE id=$id");
mysql_query("UPDATE torrents SET seeders=seeders+1 WHERE id=$id") or sqlerr(__FILE____LINE__);
header("Location: $site_url/details.php?id=$id&uploaded=1");
?>

Last edited by Krypto; 25-12-12 at 23:12. Reason: Quote Tags changed to php Tags
Reply With Quote
  #24  
Old 25-12-12, 16:38
Tones's Avatar
Tones Tones is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 154
Default Nice!!
Merci man!!

Bump:
Quote:
Originally Posted by ExtremeGaby View Post
poftim modul de takeupload.php sa vada 1 seeders

PHP Code:
<?php

/*
*-------------------------------------------------------------------------------*
*----------------    |  ____|        |__   __/ ____|  __ \        --------------*
*----------------    | |__ _ __ ___  ___| | | (___ | |__) |       --------------*
*----------------    |  __| '__/ _ \/ _ \ |  \___ \|  ___/        --------------*
*----------------    | |  | | |  __/  __/ |  ____) | |            --------------*
*----------------    |_|  |_|  \___|\___|_| |_____/|_|            --------------*
*-------------------------------------------------------------------------------*
*---------------------------    FreeTSP RC 3.0   -------------------------------*
*-------------------   The Alternate BitTorrent Source   -----------------------*
*-------------------------------------------------------------------------------*
*-------------------------------------------------------------------------------*
*--   This program is free software; you can redistribute it and/or modify    --*
*--   it under the terms of the GNU General Public License as published by    --*
*--   the Free Software Foundation; either version 2 of the License, or       --*
*--   (at your option) any later version.                                     --*
*--                                                                           --*
*--   This program is distributed in the hope that it will be useful,         --*
*--   but WITHOUT ANY WARRANTY; without even the implied warranty of          --*
*--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           --*
*--   GNU General Public License for more details.                            --*
*--                                                                           --*
*--   You should have received a copy of the GNU General Public License       --*
*--   along with this program; if not, write to the Free Software             --*
*-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  --*
*--                                                                           --*
*-------------------------------------------------------------------------------*
*------------   Original Credits to tbSource, Bytemonsoon, TBDev   -------------*
*-------------------------------------------------------------------------------*
*--------           Developed By: Krypto, Fireknight, Subzero           --------*
*-------------------------------------------------------------------------------*
*-----------------       First Release Date August 2010      -------------------*
*-----------                 http://www.freetsp.info                 -----------*
*------                    2010 FreeTSP Development Team                  ------*
*-------------------------------------------------------------------------------*
*/

require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'functions'.DIRECTORY_SEPARATOR.'function_main.php');
require_once(
INCL_DIR.'function_user.php');
require_once(
INCL_DIR.'function_vfunctions.php');
require_once(
INCL_DIR.'function_torrenttable.php');
require_once(
INCL_DIR.'function_benc.php');
require_once(
INCL_DIR.'function_page_verify.php');

ini_set("upload_max_filesize",$max_torrent_size);

db_connect();
logged_in();

$newpage = new page_verify();
$newpage->check('_upload_');

if (
get_user_class() < UC_USER)
    die;

foreach(
explode(":","descr:type:name") AS $v) {
    if (!isset(
$_POST[$v]))
        
error_message("error","Upload Failed!","Missing Form Data");
}

if (!isset(
$_FILES["file"]))
    
error_message("error","Upload Failed!","Missing Form Data");

$f     $_FILES["file"];
$fname unesc($f["name"]);

if (empty(
$fname))
{
    
error_message("error","Upload Failed!","Empty filename!");
}

$nfo sqlesc('');

if(isset(
$_FILES['nfo']) && !empty($_FILES['nfo']['name']))
{
    
$nfofile $_FILES['nfo'];

    if (
$nfofile['name'] == '')
        
error_message("error","Upload Failed!","No NFO!");

    if (
$nfofile['size'] == 0)
        
error_message("error","Upload Failed!","0-byte NFO");

    if (
$nfofile['size'] > 65535)
        
error_message("error","Upload Failed!","NFO is too big! Max 65,535 bytes.");

    
$nfofilename $nfofile['tmp_name'];

    if (@!
is_uploaded_file($nfofilename))
        
error_message("error","Upload Failed!","NFO Upload Failed");

    
$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));
}

$descr unesc($_POST["descr"]);

$tube unesc($_POST["tube"]);

if (!
$descr)
{
    
error_message("error","Upload Failed!","You must enter a Description!");
}

$catid = ($_POST["type"]);

if (!
is_valid_id($catid))
{
    
error_message("error","Upload Failed!","You must select a Category to put the torrent in!");
}

if (!
validfilename($fname))
{
    
error_message("error","Upload Failed!","Invalid Filename!");
}

if (!
preg_match('/^(.+)\.torrent$/si'$fname$matches))
{
    
error_message("error","Upload Failed!","Invalid Filename (Not a .torrent).");
}

$shortfname $torrent $matches[1];

if (!empty(
$_POST["name"]))
{
    
$torrent unesc($_POST["name"]);
}

if (!empty(
$_POST["poster"]))
{
     
$poster unesc($_POST["poster"]);
}

$tmpname $f["tmp_name"];

if (!
is_uploaded_file($tmpname))
{
    
error_message("error","Upload Failed!","eek");
}

if (!
filesize($tmpname))
{
    
error_message("error","Upload Failed!","Empty file!");
}

$dict bdec_file($tmpname$max_torrent_size);

if (!isset(
$dict))
{
    
error_message("error","Upload Failed!","What the hell did you upload? This is not a bencoded file!");
}

function 
dict_check($d$s)
{
    if (
$d["type"] != "dictionary")
    {
        
error_message("error","Upload Failed","not a dictionary");
    }

    
$a   explode(":"$s);
    
$dd  $d["value"];
    
$ret = array();
    
$t   '';

    foreach (
$a AS $k)
    {
        unset(
$t);

        if (
preg_match('/^(.*)\((.*)\)$/'$k$m))
        {
            
$k $m[1];
            
$t $m[2];
        }

        if (!isset(
$dd[$k]))
        {
            
error_message("error","Upload Failed!","Dictionary is missing Key(s)");
        }

        if (isset(
$t))
        {
            if (
$dd[$k]["type"] != $t)
            {
                
error_message("error","Upload Failed!","Invalid entry in Dictionary");
            }
            
$ret[] = $dd[$k]["value"];
        }
        else
        {
            
$ret[] = $dd[$k];
        }
    }
    return 
$ret;
}

function 
dict_get($d$k$t)
{
    if (
$d["type"] != "dictionary")
    {
        
error_message("error","Upload Failed!","Not a Dictionary");
    }

    
$dd $d["value"];

    if (!isset(
$dd[$k]))
    {
        return;
    }

    
$v $dd[$k];

    if (
$v["type"] != $t)
    {
        
error_message("error","Upload Failed!","Invalid Dictionary entry type");
    }
    return 
$v["value"];
}

list(
$ann$info) = dict_check($dict"announce(string):info");
list(
$dname$plen$pieces) = dict_check($info"name(string):piece length(integer):pieces(string)");

$passkey=$announce_urls[0].'?passkey='.$CURUSER['passkey'];

//if ($passkey != $ann)
//    error_message("error","Upload Failed!","Invalid Announce URL! must be <b>" . $announce_urls[0] . "</b>");

if (strlen($pieces) % 20 != 0)
{
    
error_message("error","Upload Failed!","Invalid Pieces");
}

$filelist = array();
$totallen dict_get($info"length""integer");

if (isset(
$totallen))
{
    
$filelist[] = array($dname$totallen);
    
$type "single";
}
else
{
    
$flist dict_get($info"files""list");

    if (!isset(
$flist))
    {
        
error_message("error","Upload Failed!","missing both length and files");
    }

    if (!
count($flist))
    {
        
error_message("error","Upload Failed!","No Files");
    }

    
$totallen 0;

    foreach (
$flist AS $fn)
    {
        list(
$ll$ff) = dict_check($fn"length(integer):path(list)");
        
$totallen += $ll;
        
$ffa = array();
        foreach (
$ff AS $ffe)
        {
            if (
$ffe["type"] != "string")
            {
                
error_message("error","Upload Failed!","Filename Error");
            }

            
$ffa[] = $ffe["value"];
        }

        if (!
count($ffa))
        {
            
error_message("error","Upload Failed!","Filename Error");
        }

        
$ffe implode("/"$ffa);
        
$filelist[] = array($ffe$ll);
    }
    
$type "multi";
}

$infohash pack("H*"sha1($info["string"]));

// Replace punctuation characters with spaces

$torrent str_replace("_"" "$torrent);
$torrent str_replace(".torrent"" "$torrent);
$torrent str_replace(".rar"" "$torrent);
$torrent str_replace(".avi"" "$torrent);
$torrent str_replace(".mpeg"" "$torrent);
$torrent str_replace(".exe"" "$torrent);
$torrent str_replace(".zip"" "$torrent);
$torrent str_replace(".wmv"" "$torrent);
$torrent str_replace(".iso"" "$torrent);
$torrent str_replace(".bin"" "$torrent);
$torrent str_replace(".txt"" "$torrent);
$torrent str_replace(".nfo"" "$torrent);
$torrent str_replace(".7z"" "$torrent);
$torrent str_replace(".mp3"" "$torrent);
$torrent str_replace("."" "$torrent);

$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));

$ret sql_query("INSERT INTO torrents (search_text, filename, owner, visible, tube, info_hash, name, size, numfiles, type, descr, ori_descr, category, save_as, added, last_action, nfo, poster) VALUES (" .
        
implode(","array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname$CURUSER["id"], "no"$tube,
 
$infohash$torrent$totallencount($filelist), $type$descr$descr$_POST["type"], $dname))) . ", '" get_date_time() . "', '" get_date_time() . "', $nfo, '".$poster."'
)"
);

if (!
$ret)
{
    if (
mysql_errno() == 1062)
    {
        
error_message("error","Upload Failed!","torrent already uploaded!");
    }
    
mysql_err();
}

$id mysql_insert_id();

@
sql_query("DELETE FROM files WHERE torrent = $id");

foreach (
$filelist AS $file)
{
    @
sql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
}

move_uploaded_file($tmpname"$torrent_dir/$id.torrent");

write_log("Torrent $id ($torrent) was uploaded by " $CURUSER["username"]);

/* RSS feeds */

if (($fd1 = @fopen("rss.xml""w")) && ($fd2 fopen("rssdd.xml""w")))
{
    
$cats "";
    
$res  sql_query("SELECT id, name FROM categories");

    while (
$arr mysql_fetch_assoc($res))
    {
        
$cats[$arr["id"]] = $arr["name"];
    }

    
$s "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" .
        
"<title>$site_name</title>\n<description>0-week torrents</description>\n<link>$site_url/</link>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);

    
$r sql_query("SELECT id,name,descr,filename,category FROM torrents ORDER BY added DESC LIMIT 15") OR sqlerr(__FILE____LINE__);

    while (
$a mysql_fetch_assoc($r))
    {
        
$cat $cats[$a["category"]];

        
$s   "<item>\n<title>" htmlspecialchars($a["name"] . " ($cat)") . "</title>\n" "<description>" htmlspecialchars($a["descr"]) . "</description>\n";

        @
fwrite($fd1$s);
        @
fwrite($fd2$s);
        @
fwrite($fd1"<link>$site_url/details.php?id=$a[id]&amp;hit=1</link>\n</item>\n");
        
$filename htmlspecialchars($a["filename"]);
        @
fwrite($fd2"<link>$site_url/download.php/$a[id]/$filename</link>\n</item>\n");
    }
    
$s "</channel>\n</rss>\n";

    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    @
fclose($fd1);
    @
fclose($fd2);
}

/* Email notifs

$res = sql_query("SELECT name FROM categories WHERE id=$catid") OR sqlerr();
$arr = mysql_fetch_assoc($res);
$cat = $arr["name"];
$res = sql_query("SELECT email FROM users WHERE enabled='yes' AND notifs LIKE '%[cat$catid]%'") OR sqlerr();
$uploader = $CURUSER['username'];

$size = mksize($totallen);
$description = ($html ? strip_tags($descr) : $descr);

$body = <<<EOD
A new torrent has been uploaded.

Name: $torrent
Size: $size
Category: $cat
Uploaded by: $uploader

Description
-------------------------------------------------------------------------------
$description
-------------------------------------------------------------------------------

You can use the URL below to download the torrent (you may have to login).

$site_url/details.php?id=$id&hit=1

--
$site_name
EOD;
$to = "";
$nmax = 100; // Max recipients per message
$nthis = 0;
$ntotal = 0;
$total = mysql_num_rows($res);
while ($arr = mysql_fetch_row($res))
{
    if ($nthis == 0)
    {
        $to = $arr[0];
    }
    else
    {
        $to .= "," . $arr[0];
    }
    ++$nthis;
    ++$ntotal;
    if ($nthis == $nmax || $ntotal == $total)
    {
        if (!mail("Multiple recipients <$site_email>", "New torrent - $torrent", $body,
            "From: $site_email\r\nBcc: $to", "-f$site_email"))
        {
            "error","Signup Failed!",("error","Error", "Your torrent has been been uploaded. DO NOT RELOAD THE PAGE!\n" .
                    "There was however a problem delivering the e-mail notifcations.\n" .
                    "Please let an administrator know about this error!\n");
        }
        $nthis = 0;
    }
}
*/

mysql_query("UPDATE torrents SET visible = 'yes' WHERE id=$id");
mysql_query("UPDATE torrents SET seeders=seeders+1 WHERE id=$id") or sqlerr(__FILE____LINE__);
header("Location: $site_url/details.php?id=$id&uploaded=1");
?>

Does not work same problem seeders disappear after a few minutes....
Reply With Quote
  #25  
Old 09-04-13, 01:08
TheGodRo's Avatar
TheGodRo TheGodRo is offline
Member
 
Join Date: Sep 2010
Posts: 14
Default
Code:
Fatal error: Call to undefined function mysql_err() in /membri/pips/takeextern.php on line 255
PHP Code:
 ", '" get_date_time() . "', '" get_date_time() . "', $nfo, 'yes')"); 
????? what is the problem?
Reply With Quote
  #26  
Old 29-10-13, 08:54
Fusi0nCr0w's Avatar
Fusi0nCr0w Fusi0nCr0w is offline
Member
 
Join Date: Apr 2013
P2P
Posts: 12
Default
If I want to use it, is a mistake. I have installed XAMPP v1.7.7. It comes in FireFox following error: Content Encoding Error. Compression problem.

Can anyone tell me what compression is used? It will be up to my XAMPP. Maybe an extension.

I would like to test the release.
Reply With Quote
  #27  
Old 29-10-13, 10:03
DND's Avatar
DND DND is offline
Support
 
Join Date: Dec 2008
Posts: 1,025
Default
so use another broswer or change the encoding settings in firefox.
Reply With Quote
  #28  
Old 04-03-14, 23:39
wdq's Avatar
wdq wdq is offline
Senior Member
 
Join Date: Mar 2010
P2P
Posts: 35
Smile
Quote:
Originally Posted by Tones View Post
Thanks man I will try to see how it works back after to tell how it goes!!

DHT works without problems if there is a problem along'll let you know!

But until then here's what appears on the home page

Warning: exec() has been disabled for security reasons in /home/u899582385/public_html/index.php on line 736

Our Tracker Load: (0 %)(these stats are an approximation)


Warning: exec() has been disabled for security reasons in /home/u899582385/public_html/index.php on line 744


Warning: exec() has been disabled for security reasons in /home/u899582385/public_html/index.php on line 747


Have you any suggestions???




Look at this ...

Click the image to open in full size.




This is a simple one, your host deactivated the exec command for security reasons i believe that is the same with others so to have this working do not call exec directly tell to exec to give you the result so the fix is put an @in front of exec, so your code for copy and paste will be

PHP Code:
<div class="cont"><div class="sthead"><div class="headtxt">Server load</div></div>
<table width=100% border=0 cellspacing=0 cellpadding=10><tr><td align=center>
<table class=interiortable border=0 width=402><tr><td style='padding: 0px; background-repeat: repeat-x'>
<? $percent = min(100, round(@exec('ps ax | grep -c apache') / 256 * 30 ));
echo "<br>Our Tracker Load: ($percent %)(these stats are an approximation)<table class=interiortable border=0 width=400><tr><td style='padding: 0px; background-image: url(pic/loadbarbg.gif); background-repeat: repeat-x'>";

    if ($percent <= 70) $pic = "http://www.bvlist.com/images/loadbargreen.gif";
     elseif ($percent <= 90) $pic = "http://www.bvlist.com/images/loadbaryellow.gif";
      else $pic = "http://www.bvlist.com/images/loadbarred.gif";
           $width = $percent * 8;
echo "<img height=15 width=$width src=\"/$pic\" alt='$percent%'></td></tr></table>";
echo "" . trim(@exec('uptime')) . "<br>";


  $percent = min(100, round(@exec('ps ax | grep -c apache') / 256 * 150));
echo "<br>Global Server Load (All websites on current host servers): ($percent %)<table class=interiortable border=0 width=400><tr><td style='padding: 0px; background-image: url(images/loadbarbg.gif); background-repeat: repeat-x'>";

    if ($percent <= 70) $pic = "http://www.bvlist.com/images/loadbargreen.gif";
     elseif ($percent <= 90) $pic = "http://www.bvlist.com/images/loadbaryellow.gif";
      else $pic = "http://www.bvlist.com/images/loadbarred.gif";
           $width = $percent * 8;
echo "<img height=15 width=$width src=\"$pic\" alt='$percent%'></td></tr></table>"; ?>
Reply With Quote
  #29  
Old 05-03-14, 00:55
DND's Avatar
DND DND is offline
Support
 
Join Date: Dec 2008
Posts: 1,025
Default
exec error is given if you use shared hosting.
Reply With Quote
  #30  
Old 05-03-14, 07:30
wdq's Avatar
wdq wdq is offline
Senior Member
 
Join Date: Mar 2010
P2P
Posts: 35
Default
Quote:
Originally Posted by DeNeDe View Post
exec error is given if you use shared hosting.
and if instead exec() was let say return=system or $array=system ?, the exec() command can be deactivated for security reasons same with system command, it can be deactivated from the apache php.ini anymay is not good overriding the way they are.
Reply With Quote
Reply

Tags
firefly , freetsp , modded , rc3unofficial , torrents tracker

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



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