Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Template Shares
Reply
  #1  
Old 15th July 2008, 05:58
Keiichi's Avatar
Keiichi Keiichi is offline
Senior Member
 
Join Date: Feb 2008
Brazil
Posts: 25
Default [FIX] TSSE Upload and Scrape
1. posible fix for upload ERROR:

Code:
What the hell did you upload? This is not a bencoded file!
benc.php

PHP Code:
<?
/***********************************************/
/*                                             */
/*    E-mail          : mrdecoder@hotmail.com  */
/*                                             */
/*              FearlesS-Releases              */
/*             One Name, One Legend            */
/*                                             */
/***********************************************/


function benc($obj) {
    if (!
is_array($obj) || !isset($obj["type"]) || !isset($obj["value"]))
    {
    return;
    }
    
    
$c $obj["value"];
    
    switch (
$obj["type"]) 
    {
    case 
"string":
        return 
benc_str($c);
    case 
"integer":
        return 
benc_int($c);
    case 
"list":
        return 
benc_list($c);
    case 
"dictionary":
        return 
benc_dict($c);
    default:
        return;
    }
}

function 
benc_str($s) {
    return 
strlen($s) . ":$s";
}

function 
benc_int($i) {
    return 
"i" $i "e";
}

function 
benc_list($a) {
    
$s "l";
    
    foreach (
$a as $e
    {
    
$s .= benc($e);
    }
    
    
$s .= "e";
    return 
$s;
}

function 
benc_dict($d) {
    
$s "d";
    
$keys array_keys($d);
    
sort($keys);
    
    foreach (
$keys as $k
    {
    
$v $d[$k];
    
$s .= benc_str($k);
    
$s .= benc($v);
    }
    
    
$s .= "e";
    return 
$s;
}

function 
bdec_file($f$ms) {

    
$fp fopen($f"rb");
    
    if (!
$fp)
    {
    return;
    }
    
    
$e fread($fp$ms);
    
fclose($fp);
    return 
bdec($e);
}

function 
bdec($s) {
    if (
preg_match('/^(\d+):/'$s$m)) 
    {
    {
    
$l $m[1];
    
$pl strlen($l) + 1;
    
$v substr($s$pl$l);
    
$ss substr($s0$pl $l);
    }
    
    if (
strlen($v) != $l)
    {
        return;
    }    
    
    return array(
type => "string"value => $vstrlen => strlen($ss), string => $ss);
    }
    
    if (
preg_match('/^i(\d+)e/'$s$m))
    {
    {
    
$v $m[1];
    
$ss "i" $v "e";
    }
    
    if (
$v === "-0")
    {
        return;
    }
    
    if (
$v[0] == "0" && strlen($v) != 1)
    {
        return;
    }    
        
    return array(
type => "integer"value => $vstrlen => strlen($ss), string => $ss);
    }
    
    switch (
$s[0]) {
    case 
"l":
        return 
bdec_list($s);
    case 
"d":
        return 
bdec_dict($s);
    default:
        return;
    }
}

function 
bdec_list($s) {

    if (
$s[0] != "l")
    {
    return;
    }
    
    
$sl strlen($s);
    
$i 1;
    
$v = array();
    
$ss "l";
    
    for (;;) 
    {    
    if (
$i >= $sl)
    {
        return;
    }
        
    if (
$s[$i] == "e")
    {
        break;
    }
    
    
$ret bdec(substr($s$i));
    
    if (!isset(
$ret) || !is_array($ret))
    {
        return;
    }    
        
    
$v[] = $ret;
    
$i += $ret["strlen"];
    
$ss .= $ret["string"];
    
    }
    
$ss .= "e";
    return array(
type => "list"value => $vstrlen => strlen($ss), string => $ss);
}

function 
bdec_dict($s) {

    if (
$s[0] != "d")
    {
    return;
    }
    
    
$sl strlen($s);
    
$i 1;
    
$v = array();
    
$ss "d";
    
    for (;;) 
    {
        if (
$i >= $sl)
        {
            return;
        }    
        
        if (
$s[$i] == "e")
        {
            break;
        }    
    
    
$ret bdec(substr($s$i));
    
    if (!isset(
$ret) || !is_array($ret) || $ret["type"] != "string")
    {
        return;
    }
        
    
$k $ret["value"];
    
$i += $ret["strlen"];
    
$ss .= $ret["string"];
    
    if (
$i >= $sl)
    {
        return;
    }    
        
    
$ret bdec(substr($s$i));
    
    if (!isset(
$ret) || !is_array($ret))
    {
        return;
    }    
        
    
$v[$k] = $ret;
    
$i += $ret["strlen"];
    
$ss .= $ret["string"];
    }
    
$ss .= "e";
    return array(
type => "dictionary"value => $vstrlen => strlen($ss), string => $ss);
}

  if (!
defined ('IN_SCRIPT_TSSEv51'))
  {
    exit (
'<font face=\"verdana\" size=\"2\" color=\"darkred\">Error! Direct initialization of this file is not allowed.</font>');
  }

  @
error_reporting (E_ALL & ~E_NOTICE);
  @
ini_set ("error_reporting"E_ALL & ~E_NOTICE);
  @
ini_set ("display_errors""0");
  @
ini_set ("display_startup_errors""0");
  @
ini_set ("ignore_repeated_errors""1");
  @
ini_set ("log_errors""1");
?>
2. TS 5.1 IOError in Azureus - Error in function gzip

scrape.php original

PHP Code:
<?
/***********************************************/
/*                                             */
/*    E-mail          : mrdecoder@hotmail.com  */
/*                                             */
/*              FearlesS-Releases              */
/*             One Name, One Legend            */
/*                                             */
/***********************************************/


  
function fast_db_connect ()
  {
    
$dbfile './config/DATABASE';
    if (!
file_exists ($dbfile))
    {
      exit (
'DATABASE Configuration file does not exists');
      return 
null;
    }

    
$data unserialize (@file_get_contents ($dbfile));
    if (!(
$connect mysql_connect ($data['mysql_host'], $data['mysql_user'], $data['mysql_pass'])))
    {
      exit (
'Error: Mysql Connection!');
      ;
    }

    if (!(
mysql_select_db ($data['mysql_db'], $connect)))
    {
      exit (
'Error: Mysql DB Selection!');
      ;
    }

    unset (
$data);
  }

  function 
sqlesc ($value)
  {
    if (
get_magic_quotes_gpc ())
    {
      
$value stripslashes ($value);
    }

    if (!
is_numeric ($value))
    {
      
$value '\'' mysql_real_escape_string ($value) . '\'';
    }

    return 
$value;
  }

  function 
hash_where ($name$hash)
  {
    return 
'' '(' $name ' = ' sqlesc ($hash) . ('' ' OR ' $name ' = ') . sqlesc (preg_replace ('/ *$/s'''$hash)) . ')';
  }

  function 
unesc ($x)
  {
    return (
get_magic_quotes_gpc () ? stripslashes ($x) : $x);
  }

  function 
hash_pad ($hash)
  {
    return 
str_pad ($hash20);
  }

  function 
benc_str ($s)
  {
    return 
strlen ($s) . ':' $s;
  }

  @
error_reporting (E_ALL & ~E_NOTICE);
  @
ini_set ('error_reporting'E_ALL & ~E_NOTICE);
  @
ini_set ('display_errors''0');
  
define ('S_VERSION''0.6 by xam');
  if (!isset (
$_GET['info_hash']))
  {
    exit (
'Permission denied!');
  }

  
fast_db_connect ();
  
$r 'd' benc_str ('files') . 'd';
  if (!(
$res mysql_query ('SELECT info_hash,seeders,times_completed,leechers FROM torrents WHERE ' hash_where ('info_hash'unesc ($_GET['info_hash'])) . ' LIMIT 1')))
  {
    exit (
'Mysql error!');
    ;
  }

  while (
$row mysql_fetch_assoc ($res))
  {
    
$r .= '20:' hash_pad ($row['info_hash']) . 'd' benc_str ('complete') . 'i' $row['seeders'] . 'e' benc_str ('downloaded') . 'i' $row['times_completed'] . 'e' benc_str ('incomplete') . 'i' $row['leechers'] . 'e' 'e';
  }

  
$r .= 'ee';
  
header ('Content-Type: text/plain');
  if ((isset (
$_SERVER['HTTP_ACCEPT_ENCODING']) AND $_SERVER['HTTP_ACCEPT_ENCODING'] == 'gzip'))
  {
    
header ('Content-Encoding: gzip');
    echo 
gzencode ($x9FORCE_GZIP);
  }
  else
  {
    echo 
$r;
  }

  unset (
$r);

Fix 1


PHP Code:
<?
/***********************************************/
/*                                             */
/*    E-mail          : mrdecoder@hotmail.com  */
/*                                             */
/*              FearlesS-Releases              */
/*             One Name, One Legend            */
/*                                             */
/***********************************************/


  
function fast_db_connect ()
  {
    
$dbfile './config/DATABASE';
    if (!
file_exists ($dbfile))
    {
      exit (
'DATABASE Configuration file does not exists');
      return 
null;
    }

    
$data unserialize (@file_get_contents ($dbfile));
    if (!(
$connect mysql_connect ($data['mysql_host'], $data['mysql_user'], $data['mysql_pass'])))
    {
      exit (
'Error: Mysql Connection!');
    }

    if (!(
mysql_select_db ($data['mysql_db'], $connect)))
    {
      exit (
'Error: Mysql DB Selection!');
    }

    unset (
$data);
  }

  function 
sqlesc ($value)
  {
    if (
get_magic_quotes_gpc ())
    {
      
$value stripslashes ($value);
    }

    if (!
is_numeric ($value))
    {
      
$value '\'' mysql_real_escape_string ($value) . '\'';
    }

    return 
$value;
  }

  function 
hash_where ($name$hash)
  {
    return 
'' '(' $name ' = ' sqlesc ($hash) . ('' ' OR ' $name ' = ') . sqlesc (preg_replace ('/ *$/s'''$hash)) . ')';
  }

  function 
unesc ($x)
  {
    return (
get_magic_quotes_gpc () ? stripslashes ($x) : $x);
  }

  function 
hash_pad ($hash)
  {
    return 
str_pad ($hash20);
  }

  function 
benc_str ($s)
  {
    return 
strlen ($s) . ':' $s;
  }
  
  @
error_reporting (E_ALL & ~E_NOTICE);
  @
ini_set ('error_reporting'E_ALL & ~E_NOTICE);
  @
ini_set ('display_errors''0');
  
define ('S_VERSION''0.6 by xam');
  if (!isset (
$_GET['info_hash']))
  {
    exit (
'Permission denied!');
  }

  
fast_db_connect ();
  
$r 'd' benc_str ('files') . 'd';
  if (!(
$res mysql_query ('SELECT info_hash,seeders,times_completed,leechers FROM torrents WHERE ' hash_where ('info_hash'unesc ($_GET['info_hash'])) . ' LIMIT 1')))
  {
    exit (
'Mysql error!');
  }

  while (
$row mysql_fetch_assoc ($res))
  {
    
$r .= '20:' hash_pad ($row['info_hash']) . 'd' benc_str ('complete') . 'i' $row['seeders'] . 'e' benc_str ('downloaded') . 'i' $row['times_completed'] . 'e' benc_str ('incomplete') . 'i' $row['leechers'] . 'e' 'e';
  }

  
$r .= 'ee';
  
  if ((isset (
$_SERVER['HTTP_ACCEPT_ENCODING']) AND $_SERVER['HTTP_ACCEPT_ENCODING'] == 'gzip')) {
   
header('Content-Type: text/plain');
   
header('Content-Encoding: gzip');
   echo 
gzencode($r9FORCE_GZIP);
  }
  else
   
header('Content-Type: text/plain'); {
  echo 
$r;
  }
  unset(
$r);

?>
Fix 2

PHP Code:
<?
/***********************************************/
/*                                             */
/*    E-mail          : mrdecoder@hotmail.com  */
/*                                             */
/*              FearlesS-Releases              */
/*             One Name, One Legend            */
/*                                             */
/***********************************************/


  
function fast_db_connect ()
  {
    
$dbfile './config/DATABASE';
    if (!
file_exists ($dbfile))
    {
      exit (
'DATABASE Configuration file does not exists');
      return 
null;
    }

    
$data unserialize (@file_get_contents ($dbfile));
    if (!(
$connect mysql_connect ($data['mysql_host'], $data['mysql_user'], $data['mysql_pass'])))
    {
      exit (
'Error: Mysql Connection!');
      ;
    }

    if (!(
mysql_select_db ($data['mysql_db'], $connect)))
    {
      exit (
'Error: Mysql DB Selection!');
      ;
    }

    unset (
$data);
  }

  function 
sqlesc ($value)
  {
    if (
get_magic_quotes_gpc ())
    {
      
$value stripslashes ($value);
    }

    if (!
is_numeric ($value))
    {
      
$value '\'' mysql_real_escape_string ($value) . '\'';
    }

    return 
$value;
  }

  function 
hash_where ($name$hash)
  {
    return 
'' '(' $name ' = ' sqlesc ($hash) . ('' ' OR ' $name ' = ') . sqlesc (preg_replace ('/ *$/s'''$hash)) . ')';
  }

  function 
unesc ($x)
  {
    return (
get_magic_quotes_gpc () ? stripslashes ($x) : $x);
  }

  function 
hash_pad ($hash)
  {
    return 
str_pad ($hash20);
  }

  function 
benc_str ($s)
  {
    return 
strlen ($s) . ':' $s;
  }

  @
error_reporting (E_ALL & ~E_NOTICE);
  @
ini_set ('error_reporting'E_ALL & ~E_NOTICE);
  @
ini_set ('display_errors''0');
  
define ('S_VERSION''0.6 by xam');
  if (!isset (
$_GET['info_hash']))
  {
    exit (
'Permission denied!');
  }

  
fast_db_connect ();
  
$r 'd' benc_str ('files') . 'd';
  if (!(
$res mysql_query ('SELECT info_hash,seeders,times_completed,leechers FROM torrents WHERE ' hash_where ('info_hash'unesc ($_GET['info_hash'])) . ' LIMIT 1')))
  {
    exit (
'Mysql error!');
    ;
  }

  while (
$row mysql_fetch_assoc ($res))
  {
    
$r .= '20:' hash_pad ($row['info_hash']) . 'd' benc_str ('complete') . 'i' $row['seeders'] . 'e' benc_str ('downloaded') . 'i' $row['times_completed'] . 'e' benc_str ('incomplete') . 'i' $row['leechers'] . 'e' 'e';
  }

  
$r .= 'ee';
  
header ('Content-Type: text/plain');

echo 
$r;
unset (
$r);
?>
These fixed are for the 4.3 TS, 5.1, 5.4 maybe 5.6
my testing with errors

Click image for larger version

Name:	IOError_in_Azureus.JPG
Views:	1116
Size:	91.4 KB
ID:	1154

Last edited by Ashur; 27th June 2009 at 18:48. Reason: edited by a possible error my
Reply With Quote
The Following 9 Users Say Thank You to Keiichi For This Useful Post:
aMiGo1972 (1st July 2009), Ashur (27th June 2009), blinko (22nd September 2009), GameOne (5th April 2009), sieucan (17th September 2009), syndrome (27th March 2009), Terminator (28th June 2009), Virusache (4th April 2009), zero (29th July 2009)
  #2  
Old 27th June 2009, 18:04
Ashur's Avatar
Ashur Ashur is offline
Senior Member
 
Join Date: Jun 2008
Posts: 523
Default
wow this is awesome now I got scrape working and CPU usage dropped down
awesome :D
__________________
Say NO to private tracking
Running TorrentHoster 2.5 on IraqiGate.org
Reply With Quote
The Following User Says Thank You to Ashur For This Useful Post:
Hyperjr (12th October 2010)
  #3  
Old 27th June 2009, 21:12
PRODIGY's Avatar
PRODIGY PRODIGY is offline
Senior Member
 
Join Date: Jun 2009
Greece
Posts: 18
Default
it doesnt work for v5.6...can somebody help me?
i get the message
Code:
What the hell did you upload? This is not a bencoded file!
Reply With Quote
  #4  
Old 28th June 2009, 13:33
rSt0n3's Avatar
rSt0n3 rSt0n3 is offline
Member
 
Join Date: Jun 2009
P2P
Posts: 13
Default bencoded file
i have the same problem...

Code:
What the hell did you upload? This is not a bencoded file!
i suposed that bencoded file has to do with benc.php, so i edited benc.php to be like that on the first post...
unfortunately it doesn't work...can anybody help me ???
Reply With Quote
  #5  
Old 28th June 2009, 14:26
Terminator's Avatar
Terminator Terminator is offline
Senior Member
 
Join Date: Sep 2008
Iraq
Posts: 45
Smile
works like a charm for us

many thnx for this awesome revolutionary work!

cheers
__________________
http://hqanime4arab.com
The Home of HQ Hand Dubbed Arabic Anime for Arabs!
Reply With Quote
  #6  
Old 30th June 2009, 06:24
fireman's Avatar
fireman fireman is offline
IonCube-R
 
Join Date: Oct 2008
Posts: 99
Smile
Quote:
Originally Posted by Keiichi View Post
These fixed are for the 4.3 TS, 5.1, 5.4 maybe 5.6
my testing with errors
The scrape works great however if i change benc file to whats list I get a message something like direct utilization of this file is not allowed and i tried to upload an external torrent when using this now the original benc file worked fine for me does anyone else have input on this

Last edited by Fynnon; 30th June 2009 at 11:51. Reason: DO NOT quote very long posts !
Reply With Quote
  #7  
Old 30th June 2009, 06:41
Ashur's Avatar
Ashur Ashur is offline
Senior Member
 
Join Date: Jun 2008
Posts: 523
Default
well if you got the original benc working then don't mess with it
i had major issues with scrape so this resolved it so I'm happy about that
__________________
Say NO to private tracking
Running TorrentHoster 2.5 on IraqiGate.org
Reply With Quote
  #8  
Old 2nd July 2009, 00:39
mmisu120000's Avatar
mmisu120000 mmisu120000 is offline
Senior Member
 
Join Date: Jun 2009
P2P
Posts: 202
Default
Quote:
Originally Posted by fireman View Post
The scrape works great however if i change benc file to whats list I get a message something like direct utilization of this file is not allowed and i tried to upload an external torrent when using this now the original benc file worked fine for me does anyone else have input on this
in benc.php there is a line where says :
PHP Code:
if (!defined ('IN_SCRIPT_TSSEv51')) 
now, if you have TSSE 5.3, 5.4, 5.4.1, you should replace it with:
PHP Code:
if (!defined ('IN_SCRIPT_TSSEv53')) 
and, if you have the 5.6 version:
PHP Code:
if (!defined ('IN_SCRIPT_TSSEv56')) 
__________________
"How terrible is wisdom when it holds no benefit for the wise?" - Louis Cypher
WDW Tracker - Using heavy modified TSSE
Reply With Quote
The Following User Says Thank You to mmisu120000 For This Useful Post:
edfara (12th August 2009)
  #9  
Old 17th September 2009, 11:17
sieucan's Avatar
sieucan sieucan is offline
Member
 
Join Date: Aug 2008
Posts: 2
Default
when i active seo setting, scrape didn't working???
can somebody help me?
Reply With Quote
  #10  
Old 17th September 2009, 22:05
informatic's Avatar
informatic informatic is offline
Senior Member
 
Join Date: Oct 2008
Sweden
Posts: 59
Default
Quote:
Originally Posted by sieucan View Post
when i active seo setting, scrape didn't working???
can somebody help me?
That's funny. Scrape works perfectly for me with SEO on. If it gives you problem, then it might be better to have it off. Besides, the SEO isn't entirely perfect, still a lot of links and etc which aren't "masked".
Reply With Quote
Reply

Tags
fix , scrape , tsse , upload

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
[FIX] Real Working Scrape for TSSE 5.4 - 5.6 Conjo Template Shares 11 4th May 2013 18:40
Upload tsse 5.1 ciobancai Template Shares 3 5th January 2010 23:24
TSSE 5.6 upload error kusanagi Template Shares 5 29th June 2009 04:24
Torrent scrape scpirt HelixiR Community Cafe 1 20th December 2008 20:36
TSSE 3.1 | Announce, Upload KiD Template Shares 2 7th December 2008 01:21



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