MJUER |
25th November 2013 17:10 |
DHT upload mod-Cleanup
PHP Code:
////////////////////////////////////////////// Scrape external Torrents /////////////////////////////////////////////
class tsniff { var $version = '1.0a'; var $class_name = 'TSniff';
var $url; var $infohash; var $seeders; var $leechers; var $completed; var $name; var $err=0; var $error;
function doscrape() { $this->err=0; $this->error=null; if(empty($this->url)) { $this->err=1; $this->error = 'Empty url'; return($this->err=1); } $ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $this->url); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_AUTOREFERER, 0); curl_setopt ($ch, CURLOPT_TIMEOUT, 4); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_MAXREDIRS, 5); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_ENCODING, 'gzip'); curl_setopt ($ch, CURLOPT_USERAGENT, 'BitTornado/T-0.3.14a (TSniff 1.0.0 - Torrent Stats)');
$dict=$x=curl_exec ($ch); if (curl_errno($ch)) { $this->error= curl_error($ch); $this->err=2; } else { curl_close($ch); $dict=bdec($dict); if(empty($dict)) { $this->err=3; $this->error="Invalid scrape results. $x"; echo $x; } elseif($dict['type']!='dictionary') { $this->err=4; $this->error="Not a Dictionary"; } else { $dict=$dict['value']['files']; if(!empty($dict)) { $dict=$dict['value']; $ih=array_keys($dict); $dict=$dict[$ih[0]]; $this->infohash=bin2hex(stripslashes($ih[0])); $dict=$dict['value']; $this->seeders=$dict['complete']['value']; $this->leechers=$dict['incomplete']['value']; $this->completed=$dict['downloaded']['value']; $this->name=$dict['name']['value']; } else { $this->err=5; $this->error="Invalid scrape info .'$x'"; } } } if($this->err) $this->seeds=$this->leechers=$this->completed=$this->name=$this->infohash=null; return($this->err); } function tsniff($url) { $this->url=$url; return($this->doscrape()); } }
mysql_query("UPDATE torrents SET seeders = '1' WHERE seeders = '0' AND extern ='yes'") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE torrents SET visible = 'yes' WHERE extern ='yes'") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE torrents SET free = 'no' WHERE extern ='yes'") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE torrents SET x2 = 'no' WHERE extern ='yes'") or sqlerr(__FILE__, __LINE__);
//-------------------------------------------------- Set free by size ---------------------------------------------------// mysql_query("UPDATE torrents SET free = 'yes' WHERE extern ='yes' AND size >'4294967296'") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE torrents SET x2 = 'yes' WHERE extern ='yes' AND size >'21474836480'") or sqlerr(__FILE__, __LINE__);
//------------------------------------------------------ Set XXX --------------------------------------------------------// mysql_query("UPDATE torrents SET free = 'no' WHERE extern ='yes' AND category ='14'") or sqlerr(__FILE__, __LINE__);
//---------------------------------------------- Set free by categories -------------------------------------------------// mysql_query("UPDATE torrents SET free = 'yes' WHERE extern ='yes' AND category ='18'") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE torrents SET free = 'yes' WHERE extern ='yes' AND category ='19'") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE torrents SET free = 'yes' WHERE extern ='yes' AND category ='33'") or sqlerr(__FILE__, __LINE__);
/////////////////////////////////////////////// END Scrape external Torrents //////////////////////////////////////////////
|