Advertisement
Th3-822

[rapidleech][d] 2shared_com.php

Jun 24th, 2012
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.86 KB | None | 0 0
  1. <?php
  2. if (!defined('RAPIDLEECH')) {
  3.     require_once("index.html");
  4.     exit;
  5. }
  6.  
  7. class d2shared_com extends DownloadClass {
  8.     public function Download($link) {
  9.         $page = $this->GetPage($link);
  10.         is_present($page, "file link that you requested is not valid", "The file link that you requested is not valid. Please contact link publisher or try to make a search");
  11.         is_present($page, "File download limit has been exceeded.", "Free download limit has been exceeded. Try again later.");
  12.         $cookie = GetCookies($page);
  13.  
  14.         if (isset($_GET ["step"]) && $_GET ["step"] == "1") {
  15.             $post = Array();
  16.             $post["userPass2"] = $_POST['userPass2'];
  17.             $cookie = urldecode($_POST['cookie']);
  18.             $page = $this->GetPage($link, $cookie, $post, $link);
  19.             is_present($page, "enter password to access this file", "The password you have entered is not valid.");
  20.         } elseif (stristr($page, 'enter password to access this file')) {
  21.             global $PHP_SELF;
  22.             $data = $this->DefaultParamArr($link, $cookie);
  23.             $data['step'] = 1;
  24.             echo "\n<form name='dl_password' action='$PHP_SELF' method='post'>\n";
  25.             foreach ($data as $name => $value) echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  26.             echo "<h4>Enter password here: <input type='text' name='userPass2' id='filepass' size='13' />&nbsp;&nbsp;<input type='submit' onclick='return check()' value='Download File' /></h4>\n";
  27.             echo "<script language='JavaScript'>\nfunction check() {\nvar pass=document.getElementById('filepass');\nif (pass.value == '') { window.alert('You didn\'t enter the password'); return false; }\nelse { return true; }\n}\n</script>\n";
  28.             echo "</form>\n</body>\n</html>";
  29.             exit;
  30.         }
  31.  
  32.         $this->getCountDown($page);
  33.  
  34.         // Retrieve download link
  35.         if (preg_match('/dc(\d+)\.2shared\.com\/download\/([^\'\"<>\r\n]+)/i', $page, $L)) {
  36.             $dllink = "http://dc" . $L[1] . ".2shared.com/download/" . $L[2];
  37.         } elseif (preg_match('@pageDownload\d/retrieveLink\.jsp\?id=[\w\-\.]+@i', $page, $RD)) {
  38.             $page = $this->GetPage('http://www.2shared.com/'.$RD[0], $cookie, 0, $link);
  39.             if (!preg_match('@https?://dc\d+\.2shared\.com/download/[^\'\"<>\s]+@i', $page, $L)) html_error("Download-link not found [2].");
  40.             $dllink = $L[0];
  41.         } else html_error("Download-link not found.");
  42.  
  43.         $this->RedirectDownload($dllink, urldecode(basename(parse_url($dllink, PHP_URL_PATH))), $cookie);
  44.     }
  45.  
  46.     private function getCountDown($page) {
  47.         if (preg_match('/var c = ([0-9])*;/', $page, $count)) {
  48.             $countDown = $count[1];
  49.             $this->CountDown($countDown);
  50.         }
  51.     }
  52.  
  53.     public function CheckBack($headers) {
  54.         is_present($headers, '?errorMaxSessions=', 'User downloading session limit is reached. Please try again in few minutes.');
  55.         //is_present($headers, '?cau2=403tNull', 'Download link has expired.');
  56.         if (stristr($headers, '?cau2=403tNull')) {
  57.             global $PHP_SELF;
  58.             echo "<center><form action='$PHP_SELF' method='POST'>\n";
  59.             $post = $this->DefaultParamArr(cut_str($headers, 'Location: ', '?cau2='));
  60.             foreach ($post as $name => $input) echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  61.             echo "<input type='submit' value='Download Again' />\n";
  62.             echo "</form></center><br />";
  63.             html_error('Download link has expired.');
  64.         }
  65.     }
  66. }
  67.  
  68. /********************************************************
  69. Fixed by Raj Malhotra on 10 April 2010 => Fix Reloading to main page when link does not exists.
  70.  
  71. Fixed by Th3-822 on 30 October 2010 => Fixed & Added support for password protected files.
  72. Fixed by Th3-822 on 25 December 2010 => Fixed: 2shared changed it's system (Again... Now shows dlink in same page)
  73. Fixed by Th3-822 on 06 March 2011 => Changed regex for new dlink format & Added error msg for download limit.
  74. Fixed by Th3-822 on 16 June 2012 => Fixed $FileName code.
  75. Fixed by Th3-822 on 04 October 2014 => Fixed download of image files.
  76. *********************************************************/
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement