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

File Tree — 2022-01-10 14:43:07 in General Chat
let me see what i can do
File Tree — 2022-01-08 19:12:38 in General Chat
use javascript to update the peers without refreshing the page
File Tree — 2022-01-08 19:10:35 in General Chat
i was planning to sell this but here you go

add this to functions.php

//scrape fxn
function mscrape($infohash , $tracker){
 require_once (__DIR__ ."/class.scraper.php");
 if(isset($infohash) && isset($tracker)){
     $scraper = new Scrapeer\Scraper();
     $rat = $scraper->scrape( $infohash, $tracker);
     if(isset($rat)){
               if(empty($rat[$infohash]["seeders"]) && empty($rat[$infohash]["leechers"])){
                   $seed  = "0";
                   $leech = "0";
               }
               elseif(empty($rat[$infohash]["leechers"]))
               {
                   $seed  = $rat[$infohash]["seeders"];
                   $leech = "0";
               }
               elseif(empty($rat[$infohash]["seeders"])){
                   $seed  = "0";
                   $leech = $ret[$infohash]["leechers"];
               }
               else {
               $seed  = $rat[$infohash]["seeders"];
               $leech = $rat[$infohash]["leechers"];
               }
       
     SQL_Query_exec("UPDATE `torrents`  SET `last_action` = '".get_date_time()."', `seeders` = '".$seed."', `leechers` = '".$leech."' WHERE `info_hash` = '".$infohash."'");
     $lmessage = "Updated Torrent: ".$infohash." with s: ".$seed." and l: ".$leech."";
       $rcode = 1;
     }else{
         if ($scraper->has_errors()){
           $lmessage = $scraper->get_errors()." _on ".$infohash;
         }
       $rcode = 0;
     }
 write_log($lmessage);
 }else{
$rcode = 0;
 }

   if($rcode == 1){
   $ret[] = array('code' => utf8_encode($rcode),'sd' => utf8_encode($seed), 'lh' => utf8_encode($leech));
   }else{
    $ret[] = array('code' => utf8_encode($rcode));  
   }
   return $ret;
}

File Tree — 2022-01-08 18:24:12 in General Chat
i think this is better: https://github.com/medariox/scrapeer
enable sockets in php config
File Tree — 2022-01-08 18:12:37 in General Chat
i used the array_flatten function because i use a different lib for scarping torrent peers.
if your script is based on php session, then you can avoid multiple view count by same user.
in old script even if you refresh the page the view is counted. so by using the below script you can avoid it :)

//page views
$pvkey_var = "v_".$id;
if(!isset($_SESSION[$pvkey_var])){
$_SESSION[$pvkey_var] = 0;
}
if (is_valid_id($id) && isset($CURUSER)){    
if($_SESSION[$pvkey_var] == 1){ }
else {
 SQL_Query_exec("UPDATE torrents SET views = views + 1 WHERE id = $id");
   $_SESSION[$pvkey_var] = 1;
}
}
File Tree — 2022-01-08 17:55:06 in General Chat
add two rows for announce urls and files. (use datatype text)
File Tree — 2022-01-08 17:52:56 in General Chat

$annlist = $TorrentInfo[6]; // announce urls
$filelist = $TorrentInfo[8]; // file list array

$tor_ftr = array_flatten($annlist);
$tor_tracks = serialize($tor_ftr);
$f_list = serialize($filelist);

//use the above vars
//like
$ret = SQL_Query_exec("INSERT INTO torrents (filename, owner, name, descr, category, added, info_hash, size, save_as, announce, external, torrentlang, anon, trackerurls, fstruct, dirname, last_action,tags,imdb) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[$fname,$CURUSER['id'],$name,$descr,$catid,$uld_d,$infohash,$torrentsize,$fname,$announce,$external,$langid,$anon,$tor_tracks,$f_list,$internalname,$uld_d,$srtag,$imdbi],'','1');


//add this function to functions.php
//convert multi to single array
function array_flatten($array) {
 if (!is_array($array)) {
   return FALSE;
 }
 $result = array();
 foreach ($array as $key => $value) {
   if (is_array($value)) {
     $result = array_merge($result, array_flatten($value));
   }
   else {
     $result[$key] = $value;
   }
 }
 return $result;
}


File Tree — 2022-01-08 12:42:24 in General Chat
my script does not contain internal trackers

for more: https://www.bvlist.com/showthread.php?t=12349
File Tree — 2022-01-08 12:37:34 in General Chat
if anybody has new ideas feel free to share
File Tree — 2022-01-08 12:36:25 in General Chat
file tree from my script

i serialized the file array and inserted into same table instead of dumping into another table(same on announce urls too)


$f_liste = unserialize($row['fstruct']);
$tprice = array_column($f_liste, 'length');
$count_len = count($tprice);
$tprice = array_column($f_liste, 'path');
?>
<div class="tree">
<ul>
   <li class="parent_li">  <i class="fas fa-folder"></i> <?php print("<b>".$row['dirname']."</b> (<b>".mksize($row['size'])."</b>) (<b>".$count_len." files</b>)"); ?>
<ul style="padding-left:42.5px;">
<?php
array_multisort($tprice, SORT_ASC, SORT_REGULAR,$f_liste);
//print_r($f_liste);
foreach($f_liste as $flist){
   $dir = '';
   $size = $flist["length"];
   $count = count($flist["path"]);
   if(isset($flist['path'][1])){
       $t_icon = "<i class=\"fas fa-folder-open\"></i>";
   }else{
       $t_icon = '';
   }
$mdir = '';
   for ($i=0; $i<$count;$i++) {
/*
if($count > 1){
$mdir = $flist["path"][0];
}
*/
   if (($i+1) == $count){
       $fname = $dir.$flist["path"][$i];
} else {  
       $dir .= $flist["path"][$i]." / ";  
   }
   }
   print("<li>".$t_icon." <small>".$fname." (".mksize($size).")</small></li>");
}
?>
</ul>
</li>
</ul>




i want a file tree output like in kickass / 1337x
work on a Json! — 2021-12-30 18:01:03 in General Chat
better use javascript to display json data
This Mod is for people who still use mysqli instead of PDO.

You can use prepared statements to avoid sql injection.

replace the code in mysql.class.php

<?php
$db_debug = 'false';

function &SQL_Query ($query) {
return new SQL_Query($query);
}

function &SQL_Query_exec ($query,$bind = '',$iden = '',$r = '0') {
$sql = new SQL_Query($query,$bind,$iden,$r);
return $sql->execute();
}
function get_result($q){
$ret = [];
while($r = $q->fetch_assoc()){
$ret[] = $r;
}
unset($r);
mysqli_free_result($q);
return $ret;
}

class SQL_Query {

private $query = "";
private $params = [];
private $bind;
private $iden;
private $rt;

function &__construct ($query,$bind,$iden,$rt) {
$this->query = $query;
$this->bind = $bind;
$this->iden = $iden;
$this->rtype = $rt;
return $this;
}

function &p ($param) {
if (is_numeric($param)) {
$this->params[] = $param;
} elseif (is_array($param)) {
$this->params[] = implode(", ", array_map(array(&$this, "escape"), $param));
} else {
$this->params[] = $this->escape($param);
}
return $this;
}

function &p_name ($param) {
$this->params[] = "`".$GLOBALS["DBconnector"]->real_escape_string($param)."`";
return $this;
}

function escape ($s) {
if(is_numeric($s)){
return $s;
}else{
return "'".$GLOBALS["DBconnector"]->real_escape_string($s)."'";
}
}
// thanks to micro
function read () {
$ret = "";
if (count($this->params)) {
reset($this->params);
for ($i = 0; $i < strlen($this->query); $i++) {
if ($this->query[$i] == "?") {
$val = current($this->params); //new var to replace thisEach
next($this->params); //new var to replace thisEach
$ret .= $val;
} else {
$ret .= $this->query[$i];
}
}
reset($this->params);
} else {
$ret = $this->query;
}
return $ret;
}

function &execute() {
global $db_debug;
$par = $this->bind; //in array
if(empty($par)){
$query = $this->read();
$res = $GLOBALS["DBconnector"]->query($query);
}else{
$query = $this->query;
$iden = $this->iden;
$stmt = $GLOBALS["DBconnector"]->prepare($query);
if(empty($iden)){
$iden = str_repeat("s",count($par));
}else{
}
$stmt->bind_param($iden, ...$par);
$stmt->execute();
if(($this->rtype)=='1'){
$res = $GLOBALS["DBconnector"]->insert_id;
}elseif(($this->rtype)=='i'){
$res = '1';
}else{
$res = $stmt->get_result();
}
}

$mysqli_error = $GLOBALS["DBconnector"]->error;
$mysqli_errno = $GLOBALS["DBconnector"]->errno;

if ($res || $mysqli_errno == 1062) {
return $res;
}

// If debug_backtrace() is available, we can find exactly where the query was called from
if (function_exists("debug_backtrace")) {
$bt = debug_backtrace();

$i = 1;

if ($bt[$i]["function"] == "SQL_Query_exec_cached" || $bt[$i]["function"] == "get_row_count_cached" || $bt[$i]["function"] == "get_row_count")
$i++;

$line = $bt[$i]["line"];
$file = str_replace(getcwd().DIRECTORY_SEPARATOR, "", $bt[$i]["file"]);
$msg = "Database Error in $file on line $line: $mysqli_error. Query was: $query.";
} else {
$file = str_replace(getcwd().DIRECTORY_SEPARATOR, "", $_SERVER["SCRIPT_FILENAME"]);
$msg = "Database Error in $file: $mysqli_error. Query was: $query";
}
       $GLOBALS["DBconnector"]->query("INSERT INTO `sqlerr` (`txt`, `time`) VALUES (".sqlesc($msg).", '".get_date_time()."')");
if($db_debug=="true"){
       if ( function_exists('show_error_msg') ){
    show_error_msg("Database Error", "Database Error. Please report this to an administrator.", 1);
}
}
}
}
?>


replace the mysqli connection code inside function dbconn() in functions.php

function_exists("mysqli_connect") or die("MySQLi support not available.");

$GLOBALS["DBconnector"] = new mysqli($mysql_host, $mysql_user, $mysql_pass,$mysql_db);
// Check connection
if ($GLOBALS["DBconnector"]->connect_error) {
  die("Connection failed: " . $GLOBALS["DBconnector"]->connect_error);
}
unset($mysql_pass); //security


USAGE

SQL_Query_exec(Query); - normal query execution

SQL_Query_exec(Query,Parameters); - prepared statement

SQL_Query_exec("SELECT username FROM users WHERE id=?",['1']);

default identifier is string (s) if you want to mention your identifier
SQL_Query_exec(Query,Parameters,identifier);  

SQL_Query_exec("SELECT username FROM users WHERE id=?",['1'],"i");


for return
SQL_Query_exec(Query,Parameters,identifier,return_type);

default is get_result();
for '1' - will return insert_id; (return auto increment id of the table).
for 'i' = will return 1, if query was successfully executed

if  i want to know whether query was executed or not

SQL_Query_exec("INSERT INTO users (username) VALUES(?)",['admin'],"s","i");


this will return 1 if query executed.

Tree file — 2021-12-18 06:48:26 in General Chat
does this support array output from torrent info scrape lib in torrent trader.

even if i encode to json, i am not sure
Tree file — 2021-12-18 06:38:43 in General Chat
does this script support array input from torrent trader
mega_scrape error — 2021-12-17 18:55:10 in v2.08 Support
just use https://github.com/medariox/scrapeer

this is an example of how i did it on xbtit.
check out: https://www.bvlist.com/showthread.php?t=12302

i already made it for my script.

remember to enable sockets in php ini

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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728