Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
User Posts

Go to Profile

problem to register — 2019-05-22 23:07:58 in v3 Support
what is the error?
missed a few sql_query_exec in mega-scrape in my post above. I edited it
not sure what you mean. What do you want changed?
try this mega-scrape
<?php
#=================================#
#  TorrentTrader v3.0 Mega-scrape #
#  Last changed by MicroMonkey    #
#=================================#

require_once("backend/functions.php");
require_once("backend/BDecode.php");
require_once("backend/parse.php");
require_once"backend/udptscraper.php";
dbconn(false);

   set_time_limit(0);
   $interval = 172800; //--| Rescrape torrents every 2 days
   $ts = gmtime() - $interval;
   $res = SQL_Query_exec("SELECT id, name, info_hash FROM torrents WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts) ORDER BY last_action DESC LIMIT 1");
   $count = get_row_count("torrents", "WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts)");

   while ($row = mysqli_fetch_array($res))
   {
       $TorrentInfo = ParseTorrent("$site_config[torrent_dir]/$row[id].torrent");
       $ann = $TorrentInfo[0];
       $annlist = array();
     
       if ($TorrentInfo[6])
       {
           foreach ($TorrentInfo[6] as $ann)
           {
               $annlist[] = $ann[0];
           }
       }
       else
           $annlist = array($ann);

       $seeders = $leechers = $downloaded = null;
     
       echo "<div style='margin-bottom:10px'><table cellpadding='5' border='1'><tr><td style='background-color:yellow'>
           <font color='darkviolet'><b>You must keep running this page until the operation is done and the next refresh will be announced.
           <br>Depending on the number of external torrents, this may take a very long time!</b></font>
       </td></tr></table></div>";
       echo "<b>Torrent ID: $row[id]</b> - <b>$row[name]</b><br><font color=blue><b>Info Hash: $row[info_hash]</b></font><br>";
     
       foreach ($annlist as $ann)
       {
           $tracker = explode("/", $ann);
           $path = array_pop($tracker);
           $oldpath = $path;
           $path = str_replace("announce", "scrape", $path);
           $tracker = implode("/", $tracker)."/".$path;
         
           if ($oldpath == $path)
           {
               echo "<br><b>$ann</b>: Scrape not supported.<br>";
               continue;
           }

           //--| TPB's tracker is dead. Use openbittorrent instead
           if ($openbittorrent_done)
               continue;

           if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker))
           {
               $tracker = "http://tracker.openbittorrent.com/scrape";
               $openbittorrent_done = 1;
           }

           if(preg_match('%udp://([^:/]*)(?::([0-9]*))?(?:/)?%si', $tracker))
           {
               $udp=true;
               try
               {
                   $timeout = 6;
                   $udp= new udptscraper($timeout);
                   $stats=$udp->scrape($tracker,$row["info_hash"]);
                   foreach ($stats as $id=>$scrape)
                   {
                       $seeders += $scrape['seeders'];
                       $leechers += $scrape['leechers'];
                       $downloaded    += $scrape['completed'];
                   }
               }
               catch(ScraperException $e)
               {
                   echo('<br><font color="red">Error: ' . $e->getMessage() . "\n");
                   echo('Connection error: ' . ($e->isConnectionError() ? 'yes' : 'no') . "</font><br>\n");
               }
           }
           else
           {
               $stats = torrent_scrape_url($tracker, $row["info_hash"]);
           }

           if ($stats['seeds'] != -1)
           {
               $seeders += $stats['seeds'];
               $leechers += $stats['peers'];
               $downloaded += $stats['downloaded'];
               echo "<br><b>$ann</b><br>";
               echo "Seeders: <font color='green'><b>".($udp?$scrape['seeders']:$stats["seeds"])."</b></font> &nbsp; | &nbsp; ";
               echo "Leechers: <font color='red'><b>".($udp?$scrape['leechers']:$stats["peers"])."</b></font> &nbsp; | &nbsp; ";
               echo "Completed: <font color='blue'><b>".($udp?$scrape['completed']:$stats["downloaded"])."</b></font><br>";
               SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");
           }
           else
           {
               echo "<br><b>$ann</b>: <font color=red>Tracker timed out.</font><br>";
               SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");
           }
       }

       if ($seeders !== null)
       {
           echo "<br><b>Totals:</b><br>";
           echo "Seeders: <font color='green'><b>$seeders</b></font> &nbsp; | &nbsp; ";
           echo"Leechers: <font color='red'><b>$leechers</b></font> &nbsp; | &nbsp; ";
           echo "Completed: <font color='blue'><b>$downloaded</b></font><br><br>";
           SQL_Query_exec("UPDATE torrents SET leechers = '".$leechers."', seeders = '".$seeders."', times_completed = '".$downloaded."', last_action = '".get_date_time()."', visible = 'yes' WHERE id = '".$row['id']."'");
       }
       else
       {
           echo "<br><b><font color=red>All trackers are timed out.</font></b><br>";
           SQL_Query_exec("UPDATE torrents SET leechers = '0', seeders='0', last_action = '".get_date_time()."' WHERE id = '".$row['id']."'");
       }
   }
   ?>

   <script language="JavaScript">
       //--| Configure refresh interval (in seconds)
       <?php
       if ($count)
           echo "var countDownInterval = 6;";
       else
           echo "var countDownInterval = 600;"; // No torrents to scrape, refresh in 10 minutes
       ?>
       //--| Configure width of displayed text, in px (applicable only in NS4)
       var c_reloadwidth=200
   </script>

   <ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>

   <script>
       var countDownTime=countDownInterval+1;
       function countDown(){
           countDownTime--;
           if (countDownTime <=0){
               countDownTime=countDownInterval;
               clearTimeout(counter)
               window.location.reload()
               return
           }
           if (document.all) //if IE 4+
               document.all.countDownText.innerText = countDownTime+" ";
           else if (document.getElementById) //--| else if NS6+
               document.getElementById("countDownText").innerHTML=countDownTime+" "
           else if (document.layers){ //--| CHANGE TEXT BELOW TO YOUR OWN
               document.c_reload.document.c_reload2.document.write('Next <a href="java script:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
               document.c_reload.document.c_reload2.document.close()
           }
           counter=setTimeout("countDown()", 1000);
       }

       function startit(){
           if (document.all||document.getElementById) //--| CHANGE TEXT BELOW TO YOUR OWN
           document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
           countDown()
       }

       if (document.all||document.getElementById)
           startit()
       else
           window.onload=startit
   </script>
<br><br>

scrape code in torrents-details
//===| Scrape External Torrents
   if ($row["external"]=='yes')
   {
       print ("<td width='160' align='right' valign='top'><table><tr>");
       if ($scrape =='1')
       {
           print("<td class='table_col1' width='150' valign='middle'>
           <div style='margin-top:5px; margin-bottom:10px; font:bold 16px Times' align='center'><font color='#FF2000'>".T_("EXTERNAL_TORRENT")."</font></div>");

           //===| UDP Scraper
           $resu = SQL_Query_exec("SELECT id, info_hash FROM torrents WHERE external = 'yes' AND id = $id");
           while ($rowu = mysqli_fetch_array($resu))
           {
               $TorrentInfo = ParseTorrent("$site_config[torrent_dir]/$rowu[id].torrent");
               $ann = $TorrentInfo[0];
               $annlist = array();

               if ($TorrentInfo[6])
               {
                   foreach ($TorrentInfo[6] as $ann)
                   {
                       $annlist[] = $ann[0];
                   }
               }
               else
                   $annlist = array($ann);

               $seeders = $leechers = $downloaded = null;
               foreach ($annlist as $ann)
               {
                   $tracker = explode("/", $ann);
                   $path = array_pop($tracker);
                   $oldpath = $path;
                   $path = str_replace("announce", "scrape", $path);
                   $tracker = implode("/", $tracker)."/".$path;

                   if ($oldpath == $path)
                   {
                       continue;
                   }
                   if ($openbittorrent_done)
                       continue;

                   if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker))
                   {
                       $tracker = "http://tracker.openbittorrent.com/scrape";
                       $openbittorrent_done = 1;
                   }
                   if(preg_match('/udp:\/\//', $tracker))
                   {
                       $udp=true;
                       try
                       {
                           $timeout = 5;
                           $udp= new udptscraper($timeout);
                           $stats=$udp->scrape($tracker,$rowu["info_hash"]);
                           //print_r($stats); exit();
                           foreach ($stats as $idu=>$scrape)
                           {
                               $seeders += $scrape['seeders'];
                               $leechers += $scrape['leechers'];
                               $downloaded    += $scrape['completed'];
                           }
                       }
                       catch(ScraperException $e)
                       {
                           $e->isConnectionError();
                       }
                   }
                   else
                   {
                       $stats = torrent_scrape_url($tracker, $rowu["info_hash"]);
                   }

                   if ($stats['seeds'] != -1)
                   {
                       $seeders += $stats['seeds'];
                       $leechers += $stats['peers'];
                       $downloaded += $stats['downloaded'];

                       SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = '".$stats[seeds]."', `leechers` = '".$stats[peers]."', `times_completed` = '".$stats[downloaded]."' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $rowu[id]");
                   }
                   else
                   {
                       SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $rowu[id]");
                   }
               }

               if ($seeders !== null)
               {
                   SQL_Query_exec("UPDATE torrents SET leechers = '".$leechers."', seeders = '".$seeders."', times_completed = '".$downloaded."', last_action = '".get_date_time()."', visible = 'yes' WHERE id = '".$rowu['id']."'");
               }
               else
               {
                   SQL_Query_exec("UPDATE torrents SET last_action = '".get_date_time()."' WHERE id='".$rowu['id']."'");
               }
           }
           //===| End UDP Scraper
                 
           if ($seeders !== null)
           {
               print ("<div style='margin-bottom:5px; margin-left:20px'><b>".T_("LIVE_STATS")."</b>: </div>");
               print ("<div style='margin-left:20px'>".T_("SEEDERS").": <font color='limegreen'>".$seeders."</font></div>");
               print ("<div style='margin-left:20px'>".T_("LEECHERS").": <font color='#FF2000'>".$leechers."</font></div>");
               print ("<div style='margin-left:20px'>".T_("COMPLETED").": <font color='#0080FF'>".$downloaded."</font></div>");
           }
           else
           {
               print ("<div style='margin-top:10px; margin-bottom:5px' align='center'><b>".T_("LIVE_STATS")."</b>: </div>");
               print ("<div style='font:italic 14px Times' align='center'><font color='#FF2000'>".T_("TRACKERS_OFFLINE")."!</font></div>");
           }
           print ("<div style='margin-top:10px; margin-bottom:10px' align='center'>
               <a href='torrents-details.php?id=".$id."'><input type='submit' name='submit' value=".T_("SUBMIT")."></a>
           </div>");
           print ("</td>");
       }
       else
       {
           print ("<td class='table_col1' width='150' valign='middle' align='center'>
               <div style='margin-top:5px; margin-bottom:10px; font:bold 16px Times' align='center'><font color='#FF2000'>".T_("EXTERNAL_TORRENT")."</font></div>
               <div style='font:normal 12px Times' align='center'>".T_("UPDATE_STATS")."</div></div>
                   <form action='torrents-details.php?id=$id&amp;scrape=1' method='post'>
                       <div style='margin-top:5px; margin-bottom:10px' align='center'><input type='submit' name='submit' value=".T_("UPDATE")." /></div>
                   </form>
               </td>");
       }
       print ("</tr></table></td>");
   }
   //===| End Scrape External Torrents
Mass Email [TTv3] — 2019-05-12 05:11:51 in v3 Mods Completed
not sure what you are saying...
reqall.php — 2019-05-11 05:21:15 in v3 Support
the request mod has not been ported over to v3 yet
External torrent scraper — 2019-05-06 21:57:06 in v3 Support
are the trackers udp?
— 2019-05-06 20:43:43 in
I posted this in case it helps anyone who wants to use some old 2.08 mods. Most of them convert easily using the code above. The functions.php code was already added to TTv3, I just posted that for reference
Install this mod first https://torrenttrader.xyz/index.php?threads/sticky-torrents-ttv3.9800/
In torrents-upload.php before


   //Uploaded ok message (update later)
   if ($external=='no')
       $message = sprintf( T_("TORRENT_UPLOAD_LOCAL"), $name, $id, $id );

add


       if ($CURUSER["edit_torrents"] == "yes")
           if(get_user_class($CURUSER) > 4){
               if ($_POST["sticky"] == "yes"){
               $updateset[] = "sticky = 'yes'";
                }else{
               $updateset[] = "sticky = 'no'";
       }
}
       $updateset[] = "freeleech = '".intval($_POST["freeleech"])."'";
       SQL_Query_exec("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");

after


print ("<tr><td colspan='2' align='center'>".T_("MAX_FILE_SIZE").": ".mksize($site_config['image_max_filesize'])."<br />".T_("ACCEPTED_FORMATS").": ".implode(", ", array_unique($site_config["allowed_image_types"]))."<br /></td></tr><tr><td align='right'>".T_("IMAGE")." 1:&nbsp;&nbsp;</td><td><input type='file' name='image0' size='50' /></td></tr><tr><td align='right'>".T_("IMAGE")." 2:&nbsp;&nbsp;</td><td><input type='file' name='image1' size='50' /></td></tr>");

add


if ($row["external"] != "yes" && $CURUSER["edit_torrents"] == "yes"){
   echo "<tr><td align='right'><b>".T_("FREE_LEECH").": </b></td><td><input type=\"checkbox\" name=\"freeleech\"" . (($row["freeleech"] == "1") ? " checked=\"checked\"" : "" ) . " value=\"1\" />".T_("FREE_LEECH_MSG")."<br /></td></tr>";
   echo "<tr><td align='right'><b>Sticky?</b></td><td><input type='checkbox' name='sticky'" .
(($row["sticky"] == "yes") ? " checked='checked'" : "" ) . " value='yes' />";
}
— 2019-05-05 19:52:20 in
I hope this is simple and helps anyone if you need it. All mysql_ references should be changed to mysqli_. DO NOT EDIT the variables in mysql.php. Leave them as they are, only change your SQL host, user, pass, and db as you normally would

ALL INFORMATION BELOW IS FOR PHP 7+ (Tested on php 7.2)

To connect to TTv3 database, use
$GLOBALS["DBconnector"]


all functions listed below require a database connection:

mysqli_affected_rows()
mysqli_insert_id()
mysqli_errno()
mysqli_error()
mysqli_query() (or change to SQL_Query_exec <--RECOMMENDED)
mysqli_close()
mysqli_real_escape_string()

The database connector is defined in backend/functions.php
This is the original 2.08 database connector (with error suppression)

   @mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('DATABASE: mysql_connect: ' . mysql_error());
   @mysql_select_db($mysql_db) or die('DATABASE: mysql_select_db: ' . mysql_error());

This is the new 3.0. I didnt use error suppression because there was no need for it, so do what suits your needs. Its very simple

   $GLOBALS["DBconnector"] = mysqli_connect($mysql_host, $mysql_user, $mysql_pass) or die('DATABASE: mysqli_connect: ' . mysqli_error($GLOBALS["DBconnector"]));
   mysqli_select_db($GLOBALS["DBconnector"],$mysql_db) or die('DATABASE: mysqli_select_db: ' . mysqli_error($GLOBALS["DBconnector"]));


here is what a simple function looks like
This is the old way
mysql_close();

this is the new way
mysqli_close($GLOBALS["DBconnector"]);


Here is an example of mysqli_real_escape_string()
this is the old way
$reason = mysql_real_escape_string($_POST["reason"]);

this is the new way
$reason = mysqli_real_escape_string($GLOBALS["DBconnector"],$_POST["reason"]);

example in functions.php
    SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup' AND last_time = $ts");
   if (!mysqli_affected_rows($GLOBALS["DBconnector"]))

This code was added to emulate 2 deprecated functions in php7 for TTv3. This was the simplest solution that made for easy conversion of older modifications without rewriting each of these functions in every modification that used them:
each();
mysql_result();

My research returned the following solutions, which are already included in TTv3;
in functions.php
/// each() replacement for php 7+. Change all instances of each() to thisEach() in all TT files. each() deprecated as of 7.2
function thisEach(&$arr) {
   $key = key($arr);
   $result = ($key === null) ? false : [$key, current($arr), 'key' => $key, 'value' => current($arr)];
   next($arr);
   return $result;
}
///end each() replacement

///mysql_result replacement for php 7+. Change all mysql_result to mysqli_result in all TT files. mysql_result deprercated/removed, so emulate it. Should switch to data_seek
function mysqli_result($res,$row=0,$col=0){
   $numrows = mysqli_num_rows($res);
   if ($numrows && $row <= ($numrows-1) && $row >=0){
       mysqli_data_seek($res,$row);
       $resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
       if (isset($resrow[$col])){
           return $resrow[$col];
       }
   }
   return false;
}
///end mysql_result replacement
there is a mysql_ left in that code. Change it to mysqli_
nice job. Thanks for posting your findings
since I cant test this mod, I read the code and this needs changed
mega_scrape
while ($row = mysqli_fetch_array($res))

just change mysql_ to mysqli_
can you show what you mean? Even tho its only a few KB, it would take an aweful lot to be of any concern, but show what you are talking about, like a screenie
does mega scrape work on ttv3? I never looked at it before. Can you link me to it?
probably $row['username']
try this. I didnt test this. Edited to remove short tags
<?php
/* ////////////////////////////////////////////////////////////////////
 [TT All] Receiver choice from list in new PM - by r@lphii
/////////////////////////////////////////////////////////////////////*/

require "backend/functions.php";
dbconn();
loggedinonly();

if (isset($_GET['action']) && $_GET['action'])
           $action=$_GET['action'];
else $action = '';;

if ($action!="find")
  {
?>

<form action="userfind_to_nick.php?action=find" name="users" method="post">
<div vlign="bottom">
 <table cellspacing=0 cellpadding=0 border=0 align=left width=100% bgcolor="#dddddd">
 <tr>
    <td class=col1 align=center><?php echo "<b>Pseudo</b>";?>:</td>
    <td class=col1 align=center><input type="text" name="user" size="30" /></td>
    <td class=col2 align=center><input type="submit" name="confirm" value="Rechercher" /></td>
 </tr>
 </table>
</div>
</form>
<?php
}
else
{
 $res=SQL_Query_exec("SELECT username FROM users WHERE username LIKE '%".mysqli_escape_string($GLOBALS["DBconnector"],$_POST["user"])."%' ORDER BY username");
 if (!$res or mysqli_num_rows($res)==0)
     {
?>
<table cellspacing=0 cellpadding=0 border=0 align=left width=100% bgcolor="#dddddd">
<tr><td><p align=center>Trouver <font color=red><b>0</b></font> membres , essayer à nouveau.<br />
<a href=userfind_to_pm.php><b>[Réessayez]</b></a></p></td></tr></table>
<?php    }
 else {
   $subres = SQL_Query_exec("SELECT COUNT(*) FROM users WHERE username LIKE '%".mysqli_real_escape_string($GLOBALS["DBconnector"],$_POST["user"])."%'");
   $subrow = mysqli_fetch_array($subres);
   $count = $subrow[0];

if ($count == "1"){?>
<p align=center>Trouver <b>1</b> membre</p>
<?php }elseif ($count >= "500"){ ?>
<p align=center>Trouver <b><?php echo $count ?></b> membres. Essayez d'être plus précis.</p>
<?php }else{ ?>
<p align=center>Trouver <b><?php echo $count ?></b> membre - Choisir ce membre.</p>
<?php } ?>
<div align="center">
 <form name=result>
<table bgcolor="dddddd" align=left width=100% cellspacing=0 cellpadding=0 border=0>
 <tr>
    <td align=center>
<?php
print("<b>Pseudo</b>");
?>
:</td>
<?php
    print("<td align=center><select name=\"name\" size=\"1\">");
    while($result=mysqli_fetch_array($res))
    print("<option name=uname value=" . $result["username"]. " />" . $result["username"] . "</option>");
    print("</select></td>");
?>
<script language=javascript>

function addusertopm(){
   window.opener.document.forms['edit'].elements['receiver'].value = document.forms['result'].elements['name'].options[document.forms['result'].elements['name'].options.selectedIndex].value;
   window.close();
}
</script>
<?php
    print("<td><input type=\"button\" name=\"confirm\" onclick=\"javascript:addusertopm()\" value=\"Choisir\"></td>");
?>
 </tr>
</table>
</form>
</div>
<?php
  }
}
?>
first post updated for class color
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728