PageRenderTime 60ms CodeModel.GetById 3ms RepoModel.GetById 0ms app.codeStats 1ms

/vinaget/vng262/class.php

http://vinaget-script.googlecode.com/
PHP | 1206 lines | 421 code | 20 blank | 765 comment | 68 complexity | cfd4c561acfba003e6848350ee31313f MD5 | raw file
  1. <?php
  2. /*
  3. * Home page: http://vinaget.us
  4. * Blog: http://blog.vinaget.us
  5. * Script Name: Vinaget
  6. * Version: 2.6.2 (10.12.2011)
  7. * Description:
  8. - Vinaget is script generator premium link that allows you to download files instantly and at the best of your Internet speed.
  9. - Vinaget is your personal proxy host protecting your real IP to download files hosted on hosters like RapidShare, megaupload, hotfile...
  10. - You can now download files with full resume support from filehosts using download managers like IDM etc
  11. - Vinaget is a Free Open Source, supported by a growing community.
  12. * Code LeechViet by VinhNhaTrang
  13. * Developed by ..:: [H] ::..
  14. */
  15. ##################################### Begin class getinfo #####################################
  16. class getinfo {
  17. function config(){
  18. include("config.php");
  19. $this->self = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\?.*$/', '', isset($_SERVER['REQUEST_URI'])? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
  20. if (!defined('vinaget')){
  21. echo '<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=http://'.$homepage.'">';
  22. exit;
  23. }
  24. if (!file_exists(".htaccess")) {
  25. echo "<CENTER><font color=red size=4>Can't find file <B>.htaccess</B></font></CENTER>";
  26. exit;
  27. }
  28. elseif (filesize(".htaccess") < 200) {
  29. #----------- Begin create file .htaccess -----------#
  30. $slashes = explode('/', $this->self);
  31. $max = count($slashes)-1;
  32. $namefolder = "";
  33. if($max>3) for($i=3;$i<$max;$i++) $namefolder .= "/".$slashes[$i];
  34. else $namefolder = "/";
  35. $strhta ="";
  36. $strhta .= "RewriteEngine on\n";
  37. $strhta .= "RewriteBase $namefolder\n";
  38. $strhta .= "RewriteCond %{REQUEST_FILENAME} !-f\n";
  39. $strhta .= "RewriteCond %{REQUEST_FILENAME} !-d\n";
  40. $strhta .= "RewriteRule ^(.*)/(.*)/ index.php?file=$2\n";
  41. $strhta .= "order deny,allow\n";
  42. $strhta .= '<files ~ "\.(php|php.*|sphp|php3|php4|php5|phtml|cgi|pl|shtml|dhtml|html|htm|txt|dat)$">';
  43. $strhta .= "\n";
  44. $strhta .= "deny from all\n";
  45. $strhta .= "</files>\n";
  46. $strhta .= "\n";
  47. $strhta .= "<files add.php>\n";
  48. $strhta .= "allow from all\n";
  49. $strhta .= "</files>\n";
  50. $strhta .= "\n";
  51. $strhta .= "<files index.php>\n";
  52. $strhta .= "allow from all\n";
  53. $strhta .= "</files>\n";
  54. $strhta .= "\n";
  55. $strhta .= "<files login.php>\n";
  56. $strhta .= "allow from all\n";
  57. $strhta .= "</files>\n";
  58. $strhta .= "\n";
  59. $strhta .= "<files log.txt>\n";
  60. $strhta .= "deny from all\n";
  61. $strhta .= "</files>\n";
  62. $strhta .= "\n";
  63. $strhta .= '<files ~ "^\.">';
  64. $strhta .= "\n";
  65. $strhta .= "deny from all\n";
  66. $strhta .= "</files>";
  67. $htafile = ".htaccess";
  68. $fhta = fopen ($htafile, "w")
  69. or die('<CENTER><font color=red size=3>could not open file! Try to chmod the folder "<B>.htaccess</B>" to 666</font></CENTER>');
  70. fwrite ($fhta, $strhta)
  71. or die('<CENTER><font color=red size=3>could not write file! Try to chmod the folder "<B>.htaccess</B>" to 666</font></CENTER>');
  72. fclose ($fhta);
  73. @chmod($htafile, 0666);
  74. #----------- End create file .htaccess -----------#
  75. }
  76. if (!file_exists ( "tmp" )) {
  77. mkdir("tmp", 0777)
  78. or die('<CENTER><font color=red size=4>Could not create folder! Try to chmod the folder "<B>tmp</B>" to 777</font></CENTER>');
  79. }
  80. if (!file_exists ( "online" )) {
  81. mkdir("online", 0777)
  82. or die('<CENTER><font color=red size=4>Could not create folder! Try to chmod the folder "<B>online</B>" to 777</font></CENTER>');
  83. }
  84. if (!file_exists ($fileinfo_dir)) {
  85. mkdir($fileinfo_dir, 0777)
  86. or die('<CENTER><font color=red size=4>Could not create folder! Try to chmod the folder "<B>files</B>" to 777</font></CENTER>');
  87. }
  88. if(!file_exists($fileinfo_dir."index.php")) {
  89. $clog=fopen($fileinfo_dir."index.php","a")
  90. or die('<CENTER><font color=red size=3>Could not create to file ! Try to chmod the folder "<B>files</B>" to 777</font></CENTER>');
  91. fwrite($clog,'<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=http://'.$homepage.'">');
  92. fclose($clog);
  93. }
  94. if ($Secure == true) $this->Deny = true;
  95. foreach ($SecureID as $login_vng)
  96. if(isset($_COOKIE["secureid"]) && $_COOKIE["secureid"] == md5($login_vng)) {
  97. $this->Deny = false;
  98. break;
  99. }
  100. $this->Secure = $Secure;
  101. $this->fileinfo_dir = $fileinfo_dir;
  102. $this->fileinfo_ext = $fileinfo_ext;
  103. $this->download_prefix = $download_prefix;
  104. $this->banned = explode(' ', '.htaccess .htpasswd .php .php3 .php4 .php5 .phtml .asp .aspx .cgi .pl'); // banned filetypes
  105. $this->unit = 1024;
  106. $this->limitMBIP = $limitMBIP;
  107. $this->ttl = $ttl;
  108. $this->limitPERIP = $limitPERIP;
  109. $this->ttl_ip = $ttl_ip;
  110. $this->max_jobs_per_ip = $max_jobs_per_ip;
  111. $this->max_jobs = $max_jobs;
  112. $this->max_load = $max_load;
  113. $this->title = $title;
  114. $this->zlink = $ziplink;
  115. $this->link_zip = $apiadf;
  116. $this->colorfn = $colorfilename;
  117. $this->colorfs = $colorfilesize;
  118. $this->badword = $badword;
  119. $this->act = $action;
  120. $this->realall = $get_realall;
  121. $this->debridmax = $get_debridmax;
  122. $this->alldebrid = $get_alldebrid;
  123. $this->fastdebrid = $get_fastdebrid;
  124. $this->listfile = $listfile;
  125. $this->checkacc = $checkacc;
  126. $this->privatef = $privatefile;
  127. $this->privateip = $privateip;
  128. $this->linkcbox = $linkforcbox;
  129. $this->check3x = $checklinksex;
  130. $this->timedelcookie = $timedelcookie;
  131. $this->filecookie = $filecookie;
  132. }
  133. function showplugin(){
  134. foreach ($this->acc as $host => $value) {
  135. $xout = array('');
  136. $xout = $this->acc[$host]['accounts'];
  137. $max_size = $this->acc[$host]['max_size'];
  138. $host=str_replace("real-debrid.com",_accreal,$host) ;
  139. $host=str_replace("alldebrid.com",_accall,$host) ;
  140. $host=str_replace("debridmax.com",_accdmax,$host) ;
  141. $host=str_replace("fast-debrid.com",_accfast,$host) ;
  142. if (empty($xout[0])==false && empty($host)==false){
  143. $hosts[]= '<span class="plugincollst">' .$host . ' '.count($xout).'</span><br>';
  144. }
  145. }
  146. if(isset($hosts)){
  147. if(count($hosts)>4){
  148. for ($i=0; $i < 5; $i++) echo "$hosts[$i]";
  149. echo "<div id=showacc style='display: none;'>";
  150. for ($i=5; $i < count($hosts); $i++) echo "$hosts[$i]";
  151. echo "</div>";
  152. }
  153. else for ($i=0; $i < count($hosts); $i++) echo "$hosts[$i]";
  154. if(count($hosts)>4) echo "<a onclick=\"showOrHide();\" href=\"javascript:void(0)\" style='TEXT-DECORATION: none'><font color=#FF6600><div id='moreacc'>"._moreacc."</div></font></a>";
  155. }
  156. return false;
  157. }
  158. function clean() {
  159. $oldest = time() - $this->ttl*60;
  160. $delete = array();
  161. foreach ($this->jobs as $key=>$job) {
  162. if ($job['mtime'] < $oldest) {
  163. $delete[] = $key;
  164. }
  165. }
  166. foreach ($delete as $url) {
  167. unset($this->jobs[$url]);
  168. }
  169. $this->save_jobs();
  170. }
  171. function clean_cookies() {
  172. $this->load_cookies();
  173. $oldest = time() - $this->timedelcookie*60;
  174. $delete = array();
  175. foreach ($this->cookies as $ckey=>$cookies) {
  176. if ($cookies['time'] < $oldest) {
  177. $delete[] = $ckey;
  178. }
  179. }
  180. foreach ($delete as $site) {
  181. unset($this->cookies[$site]);
  182. }
  183. $this->save_cookies("","");
  184. }
  185. function getFileInfo(){
  186. $this->fileinfo = "";
  187. $dir = opendir($this->fileinfo_dir);
  188. $lists = array();
  189. while ($file = readdir($dir)){
  190. if (substr($file,-strlen($this->fileinfo_ext)-1) == "." . $this->fileinfo_ext){
  191. $lists[] = $this->fileinfo_dir . $file;
  192. }
  193. }
  194. closedir($dir);
  195. if (count($lists)){
  196. sort($lists);
  197. $this->fileinfo = array_pop($lists);
  198. foreach ($lists as $file){
  199. @unlink($file);
  200. }
  201. }
  202. }
  203. function load_jobs(){
  204. if (isset($this->jobs)) return;
  205. $this->getFileInfo();
  206. $this->jobs_data = @file_get_contents($this->fileinfo);
  207. $this->jobs = @unserialize($this->jobs_data);
  208. if (! is_array($this->jobs)){
  209. $this->jobs = array();
  210. $this->jobs_data = 'wtf';
  211. }
  212. }
  213. function save_jobs(){
  214. if (!isset($this->jobs))return;
  215. $this->getFileInfo();
  216. $this->fileinfo = $this->fileinfo_dir . time() . "." . $this->fileinfo_ext;
  217. $tmp = serialize($this->jobs);
  218. if ($tmp !== $this->jobs_data){
  219. $this->jobs_data = $tmp;
  220. $fh = fopen($this->fileinfo, 'w') or die('<CENTER><font color=red size=3>Could not open file ! Try to chmod the folder "<B>'.$this->fileinfo_dir.'</B>" to 777</font></CENTER>');
  221. fwrite($fh, $this->jobs_data);
  222. fclose($fh);
  223. @chmod($this->fileinfo, 0666);
  224. return true;
  225. }
  226. }
  227. function load_cookies(){
  228. if (isset($this->cookies)){
  229. return;
  230. }
  231. $this->cookies_data = @file_get_contents($this->fileinfo_dir.$this->filecookie);
  232. $this->cookies = @unserialize($this->cookies_data);
  233. if (! is_array($this->cookies))
  234. {
  235. $this->cookies = array();
  236. $this->cookies_data = 'wtf';
  237. }
  238. }
  239. function get_cookie($site){
  240. $cookie="";
  241. if(isset($this->cookies) && count($this->cookies)>0){
  242. foreach ($this->cookies as $ckey=>$cookies){
  243. if ($ckey === $site){
  244. $cookie = $cookies['cookie'];
  245. break;
  246. }
  247. }
  248. }
  249. return $cookie;
  250. }
  251. function save_cookies($site,$cookie){
  252. if (!isset($this->cookies)) return;
  253. if($site){
  254. $cookies = array(
  255. 'cookie' => $cookie,
  256. 'time' => time(),
  257. );
  258. $this->cookies[$site] = $cookies;
  259. }
  260. $tmp = serialize($this->cookies);
  261. if ($tmp !== $this->cookies_data){
  262. $this->cookies_data = $tmp;
  263. $fh = fopen($this->fileinfo_dir.$this->filecookie, 'w')
  264. or die('<CENTER><font color=red size=3>Could not open file ! Try to chmod the folder "<B>'.$this->fileinfo_dir.'</B>" to 777</font></CENTER>');
  265. fwrite($fh, $this->cookies_data)
  266. or die('<CENTER><font color=red size=3>Could not write file ! Try to chmod the folder "<B>'.$this->fileinfo_dir.'</B>" to 777</font></CENTER>');
  267. fclose($fh);
  268. @chmod($this->fileinfo_dir.$this->filecookie, 0666);
  269. return true;
  270. }
  271. }
  272. function get_load($i = 0){
  273. $load = array('0', '0', '0');
  274. if (@file_exists('/proc/loadavg')){
  275. if ($fh = @fopen('/proc/loadavg', 'r')){
  276. $data = @fread($fh, 15);
  277. @fclose($fh);
  278. $load = explode(' ', $data);
  279. }
  280. }
  281. else{
  282. if ($serverstats = @exec('uptime')){
  283. if (preg_match('/(?:averages)?\: ([0-9\.]+),?[\s]+([0-9\.]+),?[\s]+([0-9\.]+)/', $serverstats, $matches)){
  284. $load = array($matches[1], $matches[2], $matches[3]);
  285. }
  286. }
  287. }
  288. return $i==-1 ? $load : $load[$i];
  289. }
  290. function lookup_ip($ip){
  291. $this->load_jobs();
  292. $cnt = 0;
  293. foreach ($this->jobs as $job)
  294. {
  295. if ($job['ip'] === $ip) $cnt++;
  296. }
  297. return $cnt;
  298. }
  299. function Checkjobs() {
  300. $REMOTE_ADDR = $_SERVER ['REMOTE_ADDR'];
  301. $heute = 0;
  302. $xhandle = opendir ( "tmp");
  303. while ( $buin = readdir ($xhandle)) {
  304. if (stristr($buin, "$REMOTE_ADDR" )) {
  305. $heute++;}
  306. }
  307. return $heute;
  308. closedir ( $xhandle );
  309. }
  310. function get_account($service){
  311. $acc = '';
  312. if (isset($this->acc[$service])){
  313. $service = $this->acc[$service];
  314. $this->max_size = $service['max_size'];
  315. if(count($service['accounts'])>0) $acc = $service['accounts'][rand(0, count($service['accounts'])-1)];
  316. }
  317. return $acc;
  318. }
  319. function GetCookies($content){
  320. preg_match_all('/Set-Cookie: (.*);/U',$content,$temp);
  321. $cookie = $temp[1];
  322. $cookies = implode('; ',$cookie);
  323. return $cookies;
  324. }
  325. function lookup_job($hash){
  326. $this->load_jobs();
  327. foreach ($this->jobs as $key=>$job)
  328. {
  329. if ($job['hash'] === $hash)
  330. {
  331. $job['url'] = $key;
  332. return $job;
  333. }
  334. }
  335. return false;
  336. }
  337. }
  338. ##################################### End class getinfo #######################################
  339. ##################################### Begin class stream_get ##################################
  340. class stream_get extends getinfo {
  341. function stream_get(){
  342. $this->config();
  343. include("account.php");
  344. $this->load_jobs();
  345. Tools_get::clean_ip();
  346. $this->cookie = '';
  347. if (isset($_REQUEST['file'])) $this->download();
  348. if (isset($_COOKIE['owner'])){
  349. $this->owner = $_COOKIE['owner'];
  350. }
  351. else{
  352. $this->owner = intval(rand()*10000);
  353. setcookie('owner', $this->owner, 0);
  354. }
  355. }
  356. function download(){
  357. error_reporting (0);
  358. sleep(2);
  359. if (! $job = $this->lookup_job($_REQUEST['file'])) die(_errorget);
  360. if (($_SERVER['REMOTE_ADDR'] !== $job['ip']) && $this->privateip==true) die(_errordl);
  361. $link = '';
  362. $filesize= $job['size'];
  363. $filename = $this->download_prefix.urldecode($job['filename']);
  364. $directlink = urldecode($job['directlink']['url']);
  365. $cookies = $job['directlink']['cookies'];
  366. if (preg_match('#^http://([a-z0-9]+\.)?filesonic\.([a-z]+)/#', $directlink)) {
  367. $page = $this->curl($directlink,$cookies,"");
  368. if(preg_match('/Location: (.*)/', $page, $match)) $link=trim($match[1]);
  369. else header("HTTP/1.0 404 Not Found");
  370. }
  371. elseif (preg_match('#^http://([a-z0-9]+\.)?wupload\.com/#', $directlink)) {
  372. $data = $this->curl($directlink,$cookies,'');
  373. if(preg_match('/ocation: (.*)/', $data, $match)) $link=trim($match[1]);
  374. else header("HTTP/1.0 404 Not Found");
  375. }
  376. else
  377. $link = $directlink;
  378. if(!$link) die(_erroracc);
  379. if($filesize <=0) {
  380. header("HTTP/1.1 404 Not Found");
  381. die ("HTTP/1.1 404 Not Found");
  382. }
  383. $range = '';
  384. if (isset($_SERVER['HTTP_RANGE'])) {
  385. $range = substr($_SERVER['HTTP_RANGE'], 6);
  386. list($start, $end) = explode('-', $range);
  387. $new_length = $filesize - $start;
  388. # Free Download Manager Support (freedownloadmanager.org)
  389. if (empty($end)) {
  390. $range = $range . ($filesize-1);
  391. }
  392. if (empty($start)) {
  393. $range = "0" . $range;
  394. }
  395. }
  396. $schema = parse_url($link);
  397. $errno = 0;
  398. $errstr = "";
  399. $port = "";
  400. if(isset($schema['port'])) $port = $schema['port'];
  401. else {$port = $schema['scheme'] == 'https' ? 443 : 80;}
  402. $host = (($schema['scheme'] == 'https') ? 'ssl://' : '').$schema['host'];
  403. $fp = @stream_socket_client ($host.":".$port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT );
  404. if (!$fp) {
  405. header("HTTP/1.0 404 Not Found");
  406. die ("HTTP/1.0 404 Not Found");
  407. }
  408. //exit;
  409. // Must be fresh start
  410. if( headers_sent() )
  411. die('Headers Sent');
  412. // Required for some browsers
  413. if(ini_get('zlib.output_compression'))
  414. ini_set('zlib.output_compression', 'Off');
  415. header("Pragma: public"); // required
  416. header("Expires: 0");
  417. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  418. header("Cache-Control: private",false); // required for certain browsers
  419. header("Content-Type: application/force-download");
  420. header("Content-Disposition: attachment; filename=".$filename);
  421. header("Content-Transfer-Encoding: binary");
  422. header("Accept-Ranges: bytes");
  423. if (empty($range)) {
  424. header("Content-Length: {$filesize}");
  425. }
  426. else {
  427. header("HTTP/1.1 206 Partial Content");
  428. header("Content-Length: $new_length");
  429. header("Content-Range: bytes $range/{$filesize}");
  430. }
  431. list($path1, $path2) = explode($schema['path'], $link);
  432. $path = $schema['path'].$path2;
  433. $data = "GET {$path} HTTP/1.1\r\n";
  434. $data .= "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1\r\n";
  435. $data .= "Host: {$schema['host']}\r\n";
  436. $data .= "Accept: */*\r\n";
  437. $data .= $cookies ? "Cookie: ".$cookies."\r\n" : '';
  438. if (!empty($range)) $data .= "Range: bytes={$range}\r\n";
  439. $data .= "Connection: Close\r\n\r\n";
  440. @stream_set_timeout($fp, 2);
  441. fputs($fp, $data);
  442. fflush($fp);
  443. $tmp = '';
  444. do {
  445. $tmp .= stream_get_line($fp, $this->unit);
  446. }
  447. while (strpos($tmp, "\r\n\r\n" ) === false);
  448. $tmp = explode("\r\n\r\n", $tmp);
  449. if ($tmp[1]) {
  450. print $tmp[1];
  451. }
  452. while (!feof($fp) && (connection_status()==0)) {
  453. $recv = @stream_get_line($fp, $this->unit);
  454. @print $recv;
  455. @flush();
  456. @ob_flush();
  457. }
  458. fclose($fp);
  459. exit;
  460. }
  461. function CheckMBIP(){
  462. $this->countMBIP = 0;
  463. $this->totalMB = 0;
  464. $this->timebw = 0;
  465. $timedata =time();
  466. foreach ($this->jobs as $job){
  467. if ($job['ip'] == $_SERVER['REMOTE_ADDR']) {
  468. $this->countMBIP = $this->countMBIP + $job['size']/1024/1024;
  469. if($job['mtime'] < $timedata ) $timedata = $job['mtime'];
  470. $this->timebw = $this->ttl*60 + $timedata -time();
  471. }
  472. if($this->privatef==false){
  473. $this->totalMB = $this->totalMB + $job['size']/1024/1024;
  474. $this->totalMB = round($this->totalMB);
  475. }
  476. else {
  477. if ($job['owner'] == $this->owner) {
  478. $this->totalMB = $this->totalMB + $job['size']/1024/1024;
  479. $this->totalMB = round($this->totalMB);
  480. }
  481. }
  482. }
  483. $this->countMBIP = round($this->countMBIP);
  484. if ($this->countMBIP >= $this->limitMBIP) return false;
  485. return true;
  486. }
  487. function curl($url,$cookies,$post){
  488. $ch = @curl_init();
  489. curl_setopt($ch, CURLOPT_URL, $url);
  490. curl_setopt($ch, CURLOPT_HEADER, 1);
  491. if ($cookies) curl_setopt($ch, CURLOPT_COOKIE, $cookies);
  492. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
  493. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  494. curl_setopt($ch, CURLOPT_REFERER,$url);
  495. if ($post){
  496. curl_setopt($ch, CURLOPT_POST, 1);
  497. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  498. }
  499. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  500. curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  501. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  502. curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 20);
  503. $page = curl_exec( $ch);
  504. curl_close($ch);
  505. return $page;
  506. }
  507. function cut_str($str, $left, $right) {
  508. $str = substr ( stristr ( $str, $left ), strlen ( $left ) );
  509. $leftLen = strlen ( stristr ( $str, $right ) );
  510. $leftLen = $leftLen ? - ($leftLen) : strlen ( $str );
  511. $str = substr ( $str, 0, $leftLen );
  512. return $str;
  513. }
  514. function GetCookies($content){
  515. preg_match_all('/Set-Cookie: (.*);/U',$content,$temp);
  516. $cookie = $temp[1];
  517. $cookies = implode('; ',$cookie);
  518. return $cookies;
  519. }
  520. function GetAllCookies($page) {
  521. $lines = explode("\n", $page);
  522. $retCookie = "";
  523. foreach ($lines as $val)
  524. {
  525. preg_match('/Set-Cookie: (.*)/',$val,$temp);
  526. if (isset($temp[1]))
  527. {
  528. if ($cook = substr($temp[1], 0, stripos($temp[1], ';')))
  529. $retCookie .= $cook . ";";
  530. }
  531. }
  532. return $retCookie;
  533. }
  534. function mf_str_conv($str_or)
  535. {
  536. $str_or = stripslashes($str_or);
  537. if (!preg_match("/unescape\(\W([0-9a-f]+)\W\);\w+=([0-9]+);[^\^]+\)([0-9\^]+)?\)\);eval/", $str_or, $match)) return $str_or;
  538. $match[3] = $match[3] ? $match[3] : "";
  539. $str_re = "";
  540. for ($i = 0; $i < $match[2]; $i++){
  541. $c = HexDec(substr($match[1], $i*2, 2));
  542. eval ("\$c = \$c".$match[3].";");
  543. $str_re .= chr($c);
  544. }
  545. $str_re = str_replace($match[0], stripslashes($str_re), $str_or);
  546. if (preg_match("/unescape\(\W([0-9a-f]+)\W\);\w+=([0-9]+);[^\^]+\)([0-9\^]+)?\)\);eval/", $str_re, $dummy))
  547. $str_re = $this->mf_str_conv($str_re);
  548. return $str_re;
  549. }
  550. function uft8html2utf8( $s ) {
  551. if ( !function_exists('uft8html2utf8_callback') ) {
  552. function uft8html2utf8_callback($t) {
  553. $dec = $t[1];
  554. if ($dec < 128) {
  555. $utf = chr($dec);
  556. } else if ($dec < 2048) {
  557. $utf = chr(192 + (($dec - ($dec % 64)) / 64));
  558. $utf .= chr(128 + ($dec % 64));
  559. } else {
  560. $utf = chr(224 + (($dec - ($dec % 4096)) / 4096));
  561. $utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64));
  562. $utf .= chr(128 + ($dec % 64));
  563. }
  564. return $utf;
  565. }
  566. }
  567. return preg_replace_callback('|&#([0-9]{1,});|', 'uft8html2utf8_callback', $s );
  568. }
  569. function main(){
  570. $this->clean();
  571. $this->load_cookies();
  572. $this->clean_cookies();
  573. if ($this->get_load() > $this->max_load){
  574. echo '<center><b><i><font color=red>'._svload.'</font></i></b></center>';
  575. return;
  576. }
  577. if (isset($_POST['urllist'])) {
  578. $_POST['urllist'] = str_replace("\r", "", urldecode($_POST['urllist']));
  579. $_POST['urllist'] = str_replace("<", "", $_POST['urllist']);
  580. $_POST['urllist'] = str_replace(">", "", $_POST['urllist']);
  581. $files = explode("\n", $_POST['urllist']);
  582. if($this->linkcbox){
  583. echo '<small style="color:#55bbff">'._linkcbox.'</small><hr /><BR>';
  584. echo "<center><input class='form' type='text' name='URL' size='100' onclick='javascript:this.focus();this.select()' readOnly value='[center]";
  585. }
  586. }
  587. if (isset($files)){
  588. $dlhtml = "";
  589. foreach ($files as $url){
  590. if(!$url) continue;
  591. if(substr($url,0,4)=='http' && strlen($url) > 10){
  592. if(!$this->check3x) $dlhtml .= $this->get($url);
  593. else{
  594. ################### CHECK 3X #########################
  595. $check3x = false;
  596. if(strpos($url,"|not3x")) {
  597. $url = str_replace("|not3x","",$url) ;
  598. }
  599. else{
  600. $data = $this->curl("http://www.google.com.vn/search?q=$url", "", "");
  601. $totalbadword = count ($this->badword);
  602. for($i = 0; $i < $totalbadword; $i++){
  603. if (stristr($data,$this->badword[$i])) {
  604. $check3x = true;
  605. break;
  606. }
  607. }
  608. }
  609. if($check3x !== true) $dlhtml .= $this->get($url);
  610. else {
  611. if($this->linkcbox)
  612. echo '[B][url=http://www.google.com.vn/search?q='.$url.'][color=red]'._sex.' [/color][color=blue]'.$url.'[/color][/b][/url][br]';
  613. $dlhtml .= '<B><font color=red>'._issex.' </font><a href=http://www.google.com.vn/search?q='.$url.'><font color=#00CC00>'.$url.'</font></a><br><font color=#FFCC00>'._ifnot.' </font><font color=#0066CC>'.$url.'</font><font color=#FF3300>|</font><font color=#ff9999 face=Arial>not3x</font></b><BR>';
  614. unset($check3x);
  615. }
  616. ################### CHECK 3X #########################
  617. }
  618. }
  619. else $dlhtml .= "<b><a href=".$url." style='TEXT-DECORATION: none'><font color=red face=Arial size=2><s>".$url."</s></font></a> <img src=images/chk_error.png width='15' alt='errorlink'> <font color=#ffcc33><B>"._errorlink."</B></font><BR>";
  620. }
  621. }
  622. if (!empty($_POST['urllist'])) {
  623. if($this->linkcbox) echo "[/center]'></center>\n";
  624. echo '<BR><hr /><small style="color:#55bbff">'._dlhere.'</small>';
  625. echo "<BR><CENTER>".$dlhtml."</center>";
  626. }
  627. }
  628. function get($url){
  629. $this->CheckMBIP();
  630. $dlhtml = "";
  631. if($this->timebw > 3600) $this->timebw = round($this->timebw/3600, 1)._hour;
  632. elseif($this->timebw > 60) $this->timebw = round($this->timebw/60, 1)._min;
  633. else $this->timebw = $this->timebw._sec;
  634. if (count($this->jobs) >= $this->max_jobs){
  635. $dlhtml .= ('<center><b><i><font color=red>'._manyjob.'</font></i></b></center>');
  636. return $dlhtml;
  637. }
  638. if ($this->countMBIP >= $this->limitMBIP){
  639. $dlhtml .= ('<center><b><i><font color=red>'._limitfile1.' '.round($this->limitMBIP/1024,2).' GB '._limitfile4.' '.$this->ttl.' '._limitfile3.' '._plwait.' <font color=green size=4>'.$this->timebw.'</font></font></i></b></center>');
  640. return $dlhtml;
  641. }
  642. if ($this->Checkjobs() >= $this->limitPERIP){
  643. $lasttime = time();
  644. $opentmp = opendir ( "tmp");
  645. while ( $infofile = readdir ( $opentmp ) ) {
  646. if ($infofile == "." || $infofile == "..") {continue;}
  647. if (stristr($infofile,$_SERVER['REMOTE_ADDR'])) {
  648. $timedl = filemtime ( "tmp/$infofile" );
  649. if($timedl < $lasttime ) $lasttime = $timedl;
  650. }
  651. }
  652. closedir ($opentmp);
  653. $lefttime = $this->ttl_ip*60 -time() + $lasttime;
  654. if($lefttime > 3600) $lefttime = round($lefttime/3600, 1)._hour;
  655. elseif($lefttime > 60) $lefttime = round($lefttime/60, 1)._min;
  656. else $lefttime = $lefttime._sec;
  657. $dlhtml .= ('<center><b><i><font color=red>'._limitfile1.' '.$this->limitPERIP.' '._limitfile2.' '.$this->ttl_ip.' '._limitfile3.' '._plwait.' <font color=green size=4>'.$lefttime.'</font></font></i></b></center>');
  658. return $dlhtml;
  659. }
  660. if ($this->lookup_ip($_SERVER['REMOTE_ADDR']) >= $this->max_jobs_per_ip){
  661. $dlhtml .= ('<center><b><i><font color=red>'._limitip.'</font></i></b></center>');
  662. return $dlhtml;
  663. }
  664. $url = trim($url);
  665. if (empty($url)) return;
  666. $Original = $url;
  667. $URL = "";
  668. $user = '';
  669. $pass = '';
  670. $cookie = '';
  671. $report = false;
  672. if((isset($_POST['use_acc']) && $_POST['use_acc']== "real_acc") || $this->realall) include ('hosts/real-debrid_com.php');
  673. elseif((isset($_POST['use_acc']) && $_POST['use_acc']== "alldebrid") || $this->alldebrid) include ('hosts/alldebrid_com.php');
  674. elseif((isset($_POST['use_acc']) && $_POST['use_acc']== "fastdebrid") || $this->fastdebrid) include ('hosts/fast-debrid_com.php');
  675. elseif((isset($_POST['use_acc']) && $_POST['use_acc']== "debridmax") || $this->debridmax) include ('hosts/debridmax_com.php');
  676. //else include ('hosts/linksnappy_com.php');
  677. if(!$URL){
  678. $download = false;
  679. include ("hosts/hosts.php");
  680. ksort($host);
  681. foreach ($host as $file => $site){
  682. $site = substr($site,0,-4);
  683. $site = str_replace("_",".",$site) ;
  684. if (preg_match('%'.$site.'%U', $url)){
  685. include ('hosts/'.$host[$file]);
  686. break;
  687. }
  688. }
  689. if(isset($link)) $URL = $link;
  690. }
  691. if($report) {
  692. return $report;
  693. }
  694. if(!$URL){
  695. $this->max_size = $this->max_size_other_host;
  696. $size_name = Tools_get::size_name($url, "");
  697. $filesize = $size_name[0];
  698. $filename = $size_name[1];
  699. if($size_name[0]>250) $URL=$url;
  700. else {
  701. include("checklink.php");
  702. return $dlhtml;
  703. }
  704. }
  705. if (!isset($filesize) || $filesize <= 0){
  706. if($URL){
  707. if($this->linkcbox) echo '[B][URL='.$url.'][color=blue][s]'.$url.'[/s][/color][/url] errorlink [color=red]'._problem.'[/color][/B]';
  708. $dlhtml .='<b><a href='.$url.' style="TEXT-DECORATION: none"><font color=red face=Arial size=2><s>'.$url.'</s></font></a> <img src=images/chk_error.png width="15" alt="errorlink"> <font color=#ffcc33 face=Arial size=2>'._problem.'</font></b><BR>';
  709. }
  710. return $dlhtml;
  711. }
  712. if($filesize >=(1024*1024*1024)) $msize = round($filesize/(1024*1024*1024), 2)." GB";
  713. elseif ($filesize >=(1024*1024)) $msize = round($filesize/(1024*1024), 2)." MB";
  714. elseif ($filesize >=1024) $msize = round($filesize/(1024), 2)." KB";
  715. else $msize = $filesize." B";
  716. $filename =urldecode($filename);
  717. $filename =$this->uft8html2utf8($filename);
  718. $filename=str_replace(".html","",$filename) ;
  719. $filename=str_replace(".htm","",$filename) ;
  720. $filename=str_replace("www","",$filename);
  721. $filename=str_replace("WWW","",$filename);
  722. $filename=str_replace("http","",$filename);
  723. $filename=str_replace("HTTP","",$filename);
  724. $filename=str_replace("'","_",$filename);
  725. $filename=str_replace("@","_",$filename);
  726. $filename=str_replace("[","_",$filename);
  727. $filename=str_replace("]","_",$filename);
  728. $filename = str_replace($this->banned, '.xxx', $filename);
  729. $hash = md5($_SERVER['REMOTE_ADDR'].$url);
  730. if ($hash === false) {
  731. $dlhtml .= ('<center><b><i><font color=red>'._cantjob.'</font></i></b></center>');
  732. return $dlhtml;
  733. }
  734. if (isset($this->jobs[$hash]) && $this->jobs[$hash]['owner']==$this->owner) {
  735. if($this->linkcbox)
  736. echo '[B][color=red]Repost Link ==> [/color][/b]';
  737. }
  738. elseif (($this->countMBIP+$filesize/(1024*1024)) >= $this->limitMBIP){
  739. $dlhtml .= ('<center><b><i><font color=red>'._limitfile1.' '.round($this->limitMBIP/1024,2).' GB '._limitfile4.' '.$this->ttl.' '._limitfile3.' '._plwait.' <font color=green size=4>'.$this->timebw.'</font></font></i></b></center>');
  740. return $dlhtml;
  741. }
  742. if ($filesize > $this->max_size*1024*1024) {
  743. if($this->linkcbox)
  744. echo '[B][color=blue]'.$url.'[/color][color=red] '.round($filesize/(1024*1024),2).' MB '._filebig.' [/color][color=green]'._allowed.'[/color][color=#d71f83] '.$this->max_size.' MB[/color][/b][br]';
  745. $dlhtml .= ('<center><b><font color=#00CC00>'.$url.'</font> <font color=red>'.round($filesize/(1024*1024),2).' MB '._filebig.' </font><font color=#3399FF>'._allowed.'</font> <font color=#FFCC00>'.$this->max_size.' MB</font></b></center>');
  746. return $dlhtml;
  747. }
  748. if ($filesize <= 0){
  749. if($URL){
  750. if($this->linkcbox) echo '[B][URL='.$url.'][color=blue][s]'.$url.'[/s][/color][/url] errorlink [color=red]'._problem.'[/color][/B]';
  751. $dlhtml .='<b><a href='.$url.' style="TEXT-DECORATION: none"><font color=red face=Arial size=2><s>'.$url.'</s></font></a> <img src=images/chk_error.png width="15" alt="errorlink"> <font color=#ffcc33 face=Arial size=2>'._problem.'</font></b><BR>';
  752. }
  753. //else include("checklink.php");
  754. return $dlhtml;
  755. }
  756. $job = array(
  757. 'hash' => substr(md5($hash), 0, 10),
  758. 'path' => substr(md5(rand()), 0, 5),
  759. 'filename' => urlencode($filename),
  760. 'size' => $filesize,
  761. 'msize' => $msize,
  762. 'mtime' => time(),
  763. 'speed' => 0,
  764. 'url' => urlencode($Original),
  765. 'owner' => $this->owner,
  766. 'ip' => $_SERVER['REMOTE_ADDR'],
  767. 'type' => 'direct',
  768. 'directlink' => array(
  769. 'url' => urlencode($URL),
  770. 'cookies'=> $this->cookie,
  771. ),
  772. );
  773. $this->jobs[$hash] = $job;
  774. $this->save_jobs();
  775. $tiam = time().rand(0,999);
  776. mkdir ( "tmp/$_SERVER[REMOTE_ADDR].$tiam", 0777 )
  777. or die('<CENTER><font color=red size=4>Could not create folder! Try to chmod the folder "<B>tmp</B>" to 777</font></CENTER>');
  778. $gach = explode('/', $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
  779. $sv_name = "";
  780. for ($i=0;$i <count($gach)-1; $i++) $sv_name .= $gach[$i]."/";
  781. $filename = preg_replace("/( |[|])/","_",$filename);
  782. $linkdown = 'http://'.$sv_name.Tools_get::site_hash($url).'/'.$job['hash'].'/'.$filename;
  783. ##########Begin short link ############
  784. if(empty($this->zlink)==false && empty($this->link_zip)==false && empty($URL)==false ){
  785. $ch = @curl_init();
  786. curl_setopt($ch, CURLOPT_URL, $this->link_zip.$linkdown);
  787. curl_setopt($ch, CURLOPT_HEADER, 0);
  788. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
  789. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  790. curl_setopt($ch, CURLOPT_TIMEOUT, 5);
  791. curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
  792. $datalink = curl_exec( $ch);
  793. curl_close($ch);
  794. if (preg_match('%(http:\/\/.++)%U', $datalink, $shortlink)) $lik = trim($shortlink[1]);
  795. else $lik = $linkdown;
  796. }
  797. ############ End short link ##########
  798. else $lik = $linkdown;
  799. //$lik = file_get_contents("http://vinaget.us/create.php?url=".$lik);
  800. if($this->linkcbox)
  801. echo "[b][URL=".$lik."] ".$this->title." | [color=".$this->colorfn."] ".$filename." [/color][color=".$this->colorfs."]($msize)[/color][/url][/b][br]";
  802. $dlhtml .= "<b><a title='kick here to download' href='$lik' style='TEXT-DECORATION: none' target='$tiam'> <font color='#00CC00'>".$filename."</font> <font color='#FF66FF'>($msize)</font></a></b><br>";
  803. return $dlhtml;
  804. }
  805. function datecmp($a, $b){
  806. return ($a[1] < $b[1]) ? 1 : 0;
  807. }
  808. function fulllist() {
  809. $act="";
  810. if($this->act['delete']==true) { $act.='<option value="del">'._del.'</option>'; }
  811. if($this->act['rename']==true) { $act.='<option value="ren">'._rname.'</option>';}
  812. if ($act != ""){
  813. if ((isset($_POST['checkbox'][0]) && $_POST['checkbox'][0] != null) || isset($_POST['renn']) || isset($_POST['remove'])){
  814. echo '<table style="width: 80%; border-collapse: collapse" border="1" align="center"><tr><td><center>';
  815. switch ($_POST['option']){
  816. case 'del': $this->deljob(); break;
  817. case 'ren': $this->renamejob(); break;
  818. }
  819. if (isset($_POST['renn'])) $this->renamejob();
  820. if (isset($_POST['remove'])) $this->deljob();
  821. echo "</center></td></tr></table><br>";
  822. }
  823. }
  824. else echo '</select>';
  825. $files = array();
  826. foreach ($this->jobs as $job) {
  827. if ($job['owner']!=$this->owner && $this->privatef==true) continue;
  828. $files[] = array(urldecode($job['url']), $job['mtime'], $job['hash'], urldecode($job['filename']),$job['size'],$job['ip'],$job['msize']);
  829. }
  830. if (count($files)==0) { echo "<Center>"._notfile."<br/><a href='$this->self'> ["._main."] </a></center>"; return;}
  831. echo "<script type=\"text/javascript\">function setCheckboxes(act){elts = document.getElementsByName(\"checkbox[]\");var elts_cnt = (typeof(elts.length) != 'undefined') ? elts.length : 0;if (elts_cnt){ for (var i = 0; i < elts_cnt; i++){elts[i].checked = (act == 1 || act == 0) ? act : (elts[i].checked ? 0 : 1);} }}</script>";
  832. echo "<center><a href=javascript:setCheckboxes(1)> Check All </a> | <a href=javascript:setCheckboxes(0)> Un-Check All </a> | <a href=javascript:setCheckboxes(2)> Invert Selection </a></center><br>";
  833. echo "<center><form action='$this->self' method='post' name='flist'><select onchange='javascript:void(document.flist.submit());'name='option'>";
  834. if ($act == "") echo "<option value=\"dis\"> "._acdis." </option>"; else echo '<option selected="selected">'._ac.'</option>'.$act;
  835. echo '</select>';
  836. echo '<div style="overflow: auto; height: auto; max-height: 450px; width: 800px;"><table id="table_filelist" class="filelist" align="left" cellpadding="3" cellspacing="1" width="100%"><thead><tr class="flisttblhdr" valign="bottom"><td id="file_list_checkbox_title" class="sorttable_checkbox">&nbsp;</td><td class="sorttable_alpha"><b>'._name.'</b></td><td><b>'._Original.'</b></td><td><b>'._Size.'</b></td><td><b>'._Date.'</b></td></tr></thead><tbody>
  837. ';
  838. usort($files, array($this, 'datecmp'));
  839. $data = "";
  840. foreach ($files as $file){
  841. $timesec = time() - $file[1];
  842. if($timesec > 24*3600) $timeago = round($timesec/86400,1)." "._dayago ;
  843. elseif($timesec > 3600) $timeago = round($timesec/3600,1)." "._hourago ;
  844. else $timeago = round($timesec/60,1)." "._minago ;
  845. if (strlen($file[3]) > 80) $file[3]= substr($file[3],0,70);
  846. $data .= "<tr class='flistmouseoff' align='center'><td><input name='checkbox[]' value='$file[2]+++$file[3]' type='checkbox'></td><td><a href='".Tools_get::site_hash($file[0])."/$file[2]/$file[3]' style='font-weight: bold; color: rgb(0, 0, 0);'>$file[3]</a></td><td><a href='$file[0]' style='color: rgb(0, 0, 0);'>"._Original."</a></td><td title='$file[5]'>".$file[6]."</td><td><a href=http://www.google.com.vn/search?q=$file[0] title='"._kickcheck."' target='$file[1]'><font color=#000000>$timeago</font></a></center></td></tr>";
  847. }
  848. //$this->CheckMBIP();
  849. echo $data;
  850. $totalall = $this->totalMB;
  851. if($totalall >= 1024) $totalall = round($totalall/1024, 1)." GB";
  852. else $totalall = $totalall." MB";
  853. $MB1IP = $this->countMBIP;
  854. if($MB1IP >= 1024) $MB1IP = round($MB1IP/1024, 1)."GB";
  855. else $MB1IP = $MB1IP."MB";
  856. $thislimitMBIP = round($this->limitMBIP/1024,0);
  857. if($this->ttl >= 24*60) $timereset = round($this->ttl/1440,1)." "._Total5 ;
  858. elseif($this->ttl >= 60) $timereset = round($this->ttl/60,1)." "._Total4 ;
  859. else $timereset = $this->ttl." "._Total3 ;
  860. echo "</tbody><tbody><tr class='flisttblftr'><td>&nbsp;</td><td>"._Total.":</td><td></td><td>$totalall</td><td>&nbsp;</td></tr></tbody></table>
  861. </div></form><center><b>"._Total1." $MB1IP/$thislimitMBIP GB - "._Total2." $timereset</b></center><br/>";
  862. //echo "<center><br><a href='$this->self'> [Back to main] </a> &nbsp;&nbsp;&nbsp; <a href='#'> [Back to top]</a></center>";
  863. }
  864. function deljob(){
  865. if($this->act['delete']==false) return;
  866. if (isset($_POST['checkbox'])){
  867. echo "<form action='$this->self' method='post'>";
  868. for ($i=0; $i < count($_POST['checkbox']); $i++){
  869. $temp = explode("+++",$_POST['checkbox'][$i]);
  870. $ftd = $temp[0];
  871. $name = $temp[1];
  872. echo "<br><b> $name </b>";
  873. echo '<input type="hidden" name="ftd[]" value="'.$ftd.'" />';
  874. echo '<input type="hidden" name="name[]" value="'.$name.'" />';
  875. }
  876. echo "<br><br><input type='submit' value='"._del."' name='remove'/> &nbsp; <input type='submit' value='"._canl."' name='Cancel'/><BR><BR>";
  877. }
  878. if (isset($_POST['remove'])){
  879. echo "<BR>";
  880. for ($i=0; $i < count($_POST['ftd']); $i++){
  881. $ftd = $_POST['ftd'][$i];
  882. $name = $_POST['name'][$i];
  883. $key = "";
  884. foreach ($this->jobs as $url=>$job){
  885. if ($job['hash'] == $ftd){
  886. $key = $url;
  887. break;
  888. }
  889. }
  890. if($key){
  891. unset($this->jobs[$key]);
  892. echo "<center>File: <b>$name</b> "._deld;
  893. }
  894. else echo "<center>File: <b>$name</b> "._notF;
  895. echo "</center>";
  896. }
  897. echo "<BR>";
  898. $this->save_jobs();
  899. }
  900. if (isset($_POST['Cancel'])){
  901. $this->fulllist();
  902. }
  903. }
  904. function renamejob(){
  905. if($this->act['rename']==false) return;
  906. if (isset($_POST['checkbox'])){
  907. echo "<form action='$this->self' method='post'>";
  908. for ($i=0; $i < count($_POST['checkbox']); $i++){
  909. $temp = explode("+++",$_POST['checkbox'][$i]);
  910. $name = $temp[1];
  911. echo "<br><b> $name </b>";
  912. echo '<input type="hidden" name="hash[]" value="'.$temp[0].'" />';
  913. echo '<input type="hidden" name="name[]" value="'.$name.'" />';
  914. echo '<br>'._nname.': <input type="text" name="nname[]" value="'.$name.'"/ size="70"><br />';
  915. }
  916. echo "<br><input type='submit' value='"._rname."' name='renn'/> &nbsp; <input type='submit' value='"._canl."' name='Cancel'/><BR><BR>";
  917. }
  918. if (isset($_POST['renn'])){
  919. for ($i=0; $i < count($_POST['name']); $i++)
  920. {
  921. $orname = $_POST['name'][$i];
  922. $hash = $_POST['hash'][$i];
  923. $nname = $_POST['nname'][$i];
  924. $nname = str_replace($this->banned,'',$nname);
  925. if ($nname == "") { echo "<BR>"._bname."<BR><BR>"; return; }
  926. else {
  927. echo "<br>";
  928. $key = "";
  929. foreach ($this->jobs as $url=>$job){
  930. if ($job['hash'] == $hash){
  931. $key = $url;
  932. $jobn = array(
  933. 'hash' => $job['hash'],
  934. 'path' => substr(md5(rand()), 0, 5),
  935. 'filename' => urlencode($nname),
  936. 'size' => $job['size'],
  937. 'msize' => $job['msize'],
  938. 'mtime' => $job['mtime'],
  939. 'speed' => 0,
  940. 'url' => $job['url'],
  941. 'owner' => $job['owner'],
  942. 'ip' => $job['ip'],
  943. 'type' => 'direct',
  944. 'directlink' => array(
  945. 'url' => $job['directlink']['url'],
  946. 'cookies'=> $job['directlink']['cookies'],
  947. ),
  948. );
  949. }
  950. }
  951. if($key){
  952. $this->jobs[$key] = $jobn;
  953. $this->save_jobs();
  954. echo "File <b>$orname</b> "._rnameto." <b>$nname</b>";
  955. }
  956. else echo "File <b>$orname</b> "._notF;
  957. echo "<br><br>";
  958. }
  959. }
  960. }
  961. if (isset($_POST['Cancel'])){
  962. $this->fulllist();
  963. }
  964. }
  965. }
  966. ##################################### End class stream_get ###################################
  967. ##################################### Begin class Tools_get ###################################
  968. class Tools_get {
  969. function clean_ip() {
  970. $xhandle = opendir ("tmp");
  971. while ($buin = readdir ($xhandle)) {
  972. if ($buin == "." || $buin == "..") {
  973. continue;
  974. }
  975. $xd = filemtime ( "tmp/$buin" );
  976. $altr = time() - $this->ttl_ip*60;
  977. if ($xd < $altr ) {
  978. if (is_dir ( "tmp/$buin" )){
  979. rmdir ( "tmp/$buin" );
  980. } else {
  981. unlink ( "tmp/$buin" );
  982. }
  983. }
  984. }
  985. closedir ( $xhandle );
  986. }
  987. function useronline() {
  988. $useronline = 0;
  989. if(!file_exists("online/".$_SERVER['REMOTE_ADDR'])) mkdir ( "online/".$_SERVER['REMOTE_ADDR'], 0777 ) or die('<CENTER><font color=red size=4>Could not create folder! Try to chmod the folder "<B>online</B>" to 777</font></CENTER>');
  990. $openfolder = opendir ("online");
  991. while ($folder = readdir ($openfolder)) {
  992. if ($folder == "." || $folder == "..") continue;
  993. if(file_exists("online/$folder")){
  994. $filemtime = filemtime ("online/$folder" );
  995. $timedel = $filemtime + 30;
  996. if (time() > $timedel ) {
  997. if (is_dir ( "online/$folder" )){
  998. rmdir ( "online/$folder" );
  999. } else {
  1000. unlink ( "online/$folder" );
  1001. }
  1002. }
  1003. else $useronline++;
  1004. }
  1005. }
  1006. closedir ( $openfolder );
  1007. return $useronline;
  1008. }
  1009. function size_name($link,$cookie){
  1010. if(!$link) return;
  1011. $schema = parse_url($link);
  1012. list($path1, $path2) = explode($schema['path'], $link);
  1013. $path = $schema['path'].$path2;
  1014. $data = "GET {$path} HTTP/1.1\r\n";
  1015. $data .= "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1\r\n";
  1016. $data .= "Host: {$schema['host']}\r\n";
  1017. $data .= $cookie ? "Cookie: $cookie\r\n" : '';
  1018. $data .= "Connection: Close\r\n\r\n";
  1019. $errno = 0;
  1020. $errstr = "";
  1021. $port = "";
  1022. if(isset($schema['port'])) $port = $schema['port'];
  1023. else {$port = $schema['scheme'] == 'https' ? 443 : 80;}
  1024. $host = (($schema['scheme'] == 'https') ? 'ssl://' : '').$schema['host'];
  1025. $fp = @stream_socket_client ($host.":".$port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT );
  1026. if (! $fp) return -1;
  1027. fputs ( $fp, $data );
  1028. fflush ( $fp );
  1029. $header = "";
  1030. do {
  1031. $header .= fgets ( $fp, 8192 );
  1032. } while ( strpos ( $header, "\r\n\r\n" ) === false );
  1033. if(stristr($header,"TTP/1.0 200 OK") || stristr($header,"TTP/1.1 200 OK") || stristr($header,"TTP/1.1 206"))
  1034. $filesize = trim ($this->cut_str ( $header, "Content-Length:", "\n" ) );
  1035. else $filesize = -1;
  1036. $filename = "";
  1037. if(stristr($header,"filename")) {
  1038. $filename = trim ($this->cut_str ( $header, "filename", "\n" ) );
  1039. //$filename=str_replace("\"","",$filename);
  1040. $filename = preg_replace("/(\"|=|\*|UTF-8|\')/","",$filename);
  1041. }
  1042. else $filename = substr(strrchr($link, '/'), 1);
  1043. return array($filesize,$filename);
  1044. }
  1045. function site_hash($url){
  1046. if(strpos($url,"rapidshare.com")) $site = "RS"; //rename_prefix
  1047. else if(strpos($url,"megaupload.com")) $site = "MU";
  1048. else if(strpos($url,"filefactory.com")) $site = "FF";
  1049. else if(strpos($url,"fileserve.com")) $site = "FS";
  1050. else if(strpos($url,"hotfile.com")) $site = "HF";
  1051. else if(strpos($url,"megavideo.com")) $site = "MV";
  1052. else if(strpos($url,"netload.in")) $site = "NL";
  1053. else if(strpos($url,"filesonic.com")) $site = "FSN";
  1054. else if(strpos($url,"depositfiles.com"))$site = "DF";
  1055. else if(strpos($url,"uploading.com"))$site = "ULD";
  1056. else if(strpos($url,"easy-share.com")) $site = "E-S";
  1057. else if(strpos($url,"filesonic")) $site = "FSN";
  1058. else if(strpos($url,"mediafire.com")) $site = "MF";
  1059. else {
  1060. $schema = parse_url($url);
  1061. $site = preg_replace("/(www.|.com|.net|.biz|.info|.org|.us|.vn|.jp|.fr|.in|.to)/","",$schema['host']);
  1062. }
  1063. return $site;
  1064. }
  1065. function report($url,$reason){
  1066. if($reason == "dead"){
  1067. if($this->linkcbox) echo '[B][URL='.$url.'][color=blue][s]'.$url.'[/s][/color][/url] errorlink [color=red]'._dead.'[/color][/B][/center]\'></center><BR/>';
  1068. $report ='<b><a href='.$url.' style="TEXT-DECORATION: none"><font color=red face=Arial size=2><s>'.$url.'</s></font></a> <img src=images/chk_error.png width="15" alt="errorlink"> <font color=#ffcc33 face=Arial size=2>'._dead.'</font></b><BR>';
  1069. return $report;
  1070. }
  1071. elseif($reason == "filebig"){
  1072. if($this->linkcbox)
  1073. echo '[B][color=blue]'.$url.'[/color][color=red] '._filebig.' [/color][color=green]'._allowed.'[/color][color=#d71f83] 200 MB[/color][/b][br]';
  1074. $report = '<center><b><font color=#00CC00>'.$url.'</font> <font color=red> '._filebig.' </font><font color=#3399FF>'._allowed.'</font> <font color=#FFCC00>200 MB</font></b></center>';
  1075. return $report;
  1076. }
  1077. elseif($reason == "erroracc"){
  1078. if($this->linkcbox)
  1079. echo '[B][URL='.$link.'][color=green]'.$link.'[/color][/url] g&#1086;&#1086;d_l&#1110;nk [color=#d71f83]'.$matches[1].'[/color] [color=red]'._notwork.'[/color][/B]';
  1080. $report = '<center><B><a href='.$link.' style="TEXT-DECORATION: none"><font color=#00FF00 face=Arial size=2>'.$link.'</font></a> <img src=images/chk_good.png width="13" alt="g&#1086;&#1086;d_l&#1110;nk"> | <font color=#ffcc33 face=Arial size=2>'.$matches[1].'</font><font color=red face=Arial size=2> '._notwork.'</font></B></center>';
  1081. return $report;
  1082. }
  1083. elseif($reason == "svload"){
  1084. if($this->linkcbox)
  1085. echo '[B][color=red]==&#9658; '._svload.' [/color][/b][br]';
  1086. $report = '<center><b><font color=red> '._svload.' </font></b></center>';
  1087. return $report;
  1088. }
  1089. elseif($reason == "captchafsn"){
  1090. if($this->linkcbox) echo '[B][color=red]'._captcha.'[/color][/b][/center]\'><BR/>';
  1091. $report ='
  1092. <h1>Attention!</h1>
  1093. <p><font color=red>We have detected some suspicious behaviour coming from your IP address (<B>'.$_SERVER['REMOTE_ADDR'].'</B>) and have been temporarily blocked. </font></p>
  1094. <script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
  1095. <div id="captchaVerification" class="section CL3">
  1096. <h3><span>Please Enter Captcha: </span></h3>
  1097. <form action="http://www.filesonic.com/report.php" method="post" id="captchaForm">
  1098. <img src="http://www.google.com/recaptcha/api/image?c='.$url.'"><BR>
  1099. <input type="text" name="recaptcha_response_field" value=""/ size="44" maxlength="50">
  1100. <input type="hidden" name="recaptcha_challenge_field" value="'.$url.'" />
  1101. <input type="submit" value="submit"/></form>
  1102. </div>';
  1103. return $report;
  1104. }
  1105. elseif($reason == "passmu"){
  1106. if($this->linkcbox) echo '[B][color=red]'._reportpass.'[/color][/b][BR]';
  1107. $report = "<center>"._reportpass."<form action='index.php' method='post'><BR>
  1108. <input type='text' id='password' name='password' width='500px'/><BR><BR>
  1109. <input type=submit value='"._sbdown."' /></form><BR>
  1110. </form></center>
  1111. ";
  1112. return $report;
  1113. }
  1114. elseif($reason == "captchawu"){
  1115. if($this->linkcbox) echo '[B][color=red]'._captcha.'[/color][/b][/center]\'><BR/>';
  1116. $report ='
  1117. <h1>Attention!</h1>
  1118. <p><font color=red>We have detected some suspicious behaviour coming from your IP address (<B>'.$_SERVER['REMOTE_ADDR'].'</B>) and have been temporarily blocked. </font></p>
  1119. <script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
  1120. <div id="captchaVerification" class="section CL3">
  1121. <h3><span>Please Enter Captcha: </span></h3>
  1122. <form action="http://www.wupload.com/report.php" method="post" id="captchaForm">
  1123. <img src="http://www.google.com/recaptcha/api/image?c='.$url.'"><BR>
  1124. <input type="text" name="recaptcha_response_field" value=""/ size="44" maxlength="50">
  1125. <input type="hidden" name="recaptcha_challenge_field" value="'.$url.'" />
  1126. <input type="submit" value="submit"/></form>
  1127. </div>';
  1128. return $report;
  1129. }
  1130. else {
  1131. if($reason == "Unavailable") $reason = _Unavailable;
  1132. elseif($reason == "disabletrial") $reason = _disabletrial;
  1133. elseif($reason == "Adult") $reason = _Adult;
  1134. elseif($reason == "youtube_captcha") $reason = _ytb_captcha;
  1135. elseif($reason == "ErrorLocating") $reason = _ytb_Error;
  1136. if($this->linkcbox) echo '[B][URL='.$url.'][color=blue]'.$url.'[/color][/url] errorlink [color=red]'.$reason.'[/color][/B]';
  1137. $report ='<b><a href='.$url.' style="TEXT-DECORATION: none"><font color=red face=Arial size=2>'.$url.'</font></a> <img src=images/chk_error.png width="15" alt="errorlink"> <font color=#ffcc33 face=Arial size=2>'.$reason.'</font></b><BR>';
  1138. }
  1139. return $report;
  1140. }
  1141. }
  1142. ##################################### End class Tools_get #####################################
  1143. ?>