Advertisement
Th3-822

[rapidleech][d] uploading_com.php

Jul 5th, 2012
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.44 KB | None | 0 0
  1. <?php
  2. if (!defined('RAPIDLEECH')) {
  3.     require_once ("index.html");
  4.     exit();
  5. }
  6. class uploading_com extends DownloadClass {
  7.     public function Download($link) {
  8.         global $premium_acc;
  9.         $this->DLregexp = '@https?://(?:[\w\-]+\.)*uploading\.com/get_file/[^\s\"\'<>]+@i';
  10.         if (empty($_REQUEST['step'])) {
  11.             $this->page = $this->GetPage($link);
  12.             is_present($this->page, 'OOPS! Looks like file not found.', 'The requested file is not found');
  13.             $this->cookie = GetCookiesArr($this->page);
  14.             if (empty($this->cookie['SID'])) html_error('Error: Cookie [SID] not found!');
  15.         }
  16.         $this->link = $link;
  17.         if ((isset($_REQUEST['cookieuse']) && $_REQUEST["cookieuse"] == 'on' && preg_match('/remembered_user=([\w.]+);?/i', $_REQUEST['cookie']) !== false) || ($_REQUEST['premium_acc'] == 'on' && !empty($premium_acc['uploading_com']['cookie']))) {
  18.             $this->changeMesg(lang(300) . '<br />Uploading.com Premium Download [Cookie]');
  19.             return $this->Login();
  20.         } elseif (($_REQUEST['premium_acc'] == 'on' && (($_REQUEST['premium_user'] && $_REQUEST['premium_pass']) || (!empty($premium_acc['uploading_com']['user']) && !empty($premium_acc['uploading_com']['pass']))))) {
  21.             $this->changeMesg(lang(300) . '<br />Uploading.com Premium Download');
  22.             return $this->Login();
  23.         } elseif (isset($_REQUEST['step']) && $_REQUEST['step'] == 'captcha') {
  24.             return $this->Login(true);
  25.         } elseif (isset($_REQUEST['step']) && $_REQUEST['step'] == 'passpre') {
  26.             return $this->Premium(true);
  27.         } else {
  28.             $this->changeMesg(lang(300) . '<br />Uploading.com Free Download');
  29.             return $this->Free();
  30.         }
  31.     }
  32.  
  33.     private function Free() {
  34.         $post_url = 'http://uploading.com/files/get/?ajax';
  35.         if (isset($_REQUEST['step']) && $_REQUEST['step'] == 'passfree') {
  36.             $code = urlencode($_POST['code']);
  37.             $pass = urlencode($_POST['password']);
  38.  
  39.             $post = array();
  40.             $post['action'] = 'check_pass';
  41.             $post['code'] = $code;
  42.             $post['pass'] = $pass;
  43.             $this->cookie = StrToCookies(urldecode($_POST['cookie']));
  44.             $page = $this->GetPage($post_url, $this->cookie, $post, $this->link."\r\nX-Requested-With: XMLHttpRequest");
  45.             $json = $this->Get_Reply($page);
  46.  
  47.             if (!empty($json['error'])) html_error('Password Error: '.$json['error']);
  48.             if (empty($json['answer']['success'])) html_error('Unknown response while checking password.');
  49.         } else {
  50.             is_present($this->page, "The file owner set up a limitation<br />that only premium members are<br />able download this file.");
  51.             is_present($this->page, "Sorry, you have reached your daily download limit.<br />Please try again tomorrow or acquire a premium membership."); // T8: I need to check this.
  52.             if (!preg_match('@code: "([^"]+)",@', $this->page, $cd)) html_error("Error: Link id not found");
  53.             $code = $cd[1];
  54.  
  55.             if (stripos($this->page, 'data-pass="true"') !== false) {
  56.                 $data = $this->DefaultParamArr($this->link, $this->cookie);
  57.                 $data['code'] = $code;
  58.                 $data['step'] = 'passfree';
  59.                 $this->EnterPassword($data);
  60.                 exit();
  61.             } else $pass = 'false';
  62.         }
  63.  
  64.         $post = array();
  65.         $post['action'] = 'second_page';
  66.         $post['code'] = $code;
  67.         //$post['pass'] = $pass;
  68.         $page = $this->GetPage($post_url, $this->cookie, $post, $this->link."\r\nX-Requested-With: XMLHttpRequest");
  69.         $json = $this->Get_Reply($page);
  70.  
  71.         if (!empty($json['error'])) html_error('Error while getting countdown: '.$json['error']);
  72.         if (!isset($json['answer']['wait_time'])) html_error('Countdown not found.');
  73.         if ($json['answer']['wait_time'] > 0) $this->CountDown($json['answer']['wait_time']);
  74.  
  75.         $post = array();
  76.         $post['action'] = 'get_link';
  77.         $post['code'] = $code;
  78.         $post['pass'] = $pass;
  79.         $page = $this->GetPage($post_url, $this->cookie, $post, $this->link."\r\nX-Requested-With: XMLHttpRequest");
  80.         $json = $this->Get_Reply($page);
  81.  
  82.         if (!empty($json['error'])) html_error('Error while getting free download link: '.$json['error']);
  83.         if (empty($json['answer']['link'])) html_error('Free dl link not found.');
  84.  
  85.         if (!preg_match($this->DLregexp, $json['answer']['link'], $dl)) {
  86.             $page = $this->GetPage($json['answer']['link'], $this->cookie);
  87.             if (preg_match('@https?://(?:[\w\-]+\.)*uploading\.com/files/(?:acc_)?thankyou/[^\s\"\'<>]+@i', $page, $redir)) {
  88.                 $this->cookie = GetCookiesArr($page, $this->cookie);
  89.                 $page = $this->GetPage(str_ireplace('/acc_thankyou/', '/thankyou/', $redir[0]), $this->cookie);
  90.             }
  91.             if (!preg_match($this->DLregexp, $page, $dl)) html_error('Download link not found.');
  92.         }
  93.  
  94.         //$filename = basename(parse_url($json['answer']['link'], PHP_URL_PATH));
  95.         $this->RedirectDownload($dl[0], 'UP_free', $this->cookie);
  96.     }
  97.  
  98.     private function Get_Reply($page) {
  99.         if (!function_exists('json_decode')) html_error("Error: Please enable JSON in php.");
  100.         $json = substr($page, strpos($page,"\r\n\r\n") + 4);
  101.         $json = substr($json, strpos($json, "{"));$json = substr($json, 0, strrpos($json, "}") + 1);
  102.         $rply = json_decode($json, true);
  103.         if (!$rply || (is_array($rply) && count($rply) == 0)) html_error("Error getting json data.");
  104.         return $rply;
  105.     }
  106.  
  107.     private function Login($captcha = false) {
  108.         global $premium_acc;
  109.         if ((isset($_REQUEST["cookieuse"]) && $_REQUEST["cookieuse"] == "on" && preg_match("/remembered_user\s*=\s*([\w|\%]+)\s*;?/i", $_REQUEST["cookie"], $c)) || ($_REQUEST["premium_acc"] == "on" && !empty($premium_acc["uploading_com"]["cookie"]))) {
  110.             $usecookie = (empty($c[1]) ? !empty($premium_acc["uploading_com"]["cookie"]) : $c[1]);
  111.         } else $usecookie = false;
  112.         $posturl = 'http://uploading.com/';
  113.         if (!$usecookie) {
  114.             $pA = !empty($_REQUEST["premium_user"]) && !empty($_REQUEST["premium_pass"]) ? true : false;
  115.             $email = ($pA ? trim($_REQUEST["premium_user"]) : $premium_acc ["uploading_com"] ["user"]);
  116.             $password = ($pA ? trim($_REQUEST["premium_pass"]) : $premium_acc ["uploading_com"] ["pass"]);
  117.             $post = array();
  118.             if ($captcha == true) {
  119.                 if (empty($_POST['recaptcha_response_field'])) html_error("You didn't enter the image verification code.");
  120.                 $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
  121.                 $post['recaptcha_response_field'] = $_POST['recaptcha_response_field'];
  122.                 $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
  123.                 if (!empty($_POST['cuser']) && !empty($_POST['cpass'])) {
  124.                     $email = decrypt(urldecode($_POST['cuser']));
  125.                     $password = decrypt(urldecode($_POST['cpass']));
  126.                 }
  127.             }
  128.             // This check is important incase there's conflict in post account data, do look in the bracket at error message...
  129.             if (empty($email) || empty($password)) html_error('Login failed, email or password is empty!');
  130.             $post['email'] = urlencode($email);
  131.             $post['password'] = urlencode($password);
  132.             $post['remember'] = 'on';
  133.             $page = $this->GetPage($posturl.'general/login_form/?ajax', $this->cookie, $post, $posturl."\r\nX-Requested-With: XMLHttpRequest");
  134.             $json = $this->Get_Reply($page);
  135.             if (!empty($json['error'])) html_error('Login Error: '.$json['error']);
  136.             if (!empty($json['answer']['captcha'])) {
  137.                 if (!preg_match('@\(\'recaptcha_block\', \'([^\']+)\'\);@', $this->page, $c)) html_error('Error: Login captcha data not found.');
  138.                 $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
  139.                 $data['step'] = 'captcha';
  140.                 if ($pA) {
  141.                     $data['cuser'] = urlencode(encrypt($email));
  142.                     $data['cpass'] = urlencode(encrypt($password));
  143.                 }
  144.                 $this->reCAPTCHA($c[1], $data);
  145.                 exit();
  146.             }
  147.             if (!empty($json['redirect'])) {
  148.                 $this->cookie = GetCookiesArr($page, $this->cookie);
  149.             } else html_error("Error [Login Page Response UNKNOWN!]");
  150.         } else {
  151.             $this->cookie['remembered_user'] = $usecookie;
  152.             $this->cookie['u'] = 1;
  153.             $this->cookie['autologin'] = 1;
  154.         }
  155.  
  156.         $page = $this->GetPage($posturl, $this->cookie, 0, $posturl);
  157.         is_present($page, 'class="i_premium"', 'Error: Account isn\'t premium?');
  158.         $this->cookie = GetCookiesArr($page, $this->cookie);
  159.  
  160.         return $this->Premium();
  161.     }
  162.  
  163.     private function Premium($password = false) {
  164.         $post_url = "http://uploading.com/files/get/?ajax";
  165.         if ($password == true) {
  166.             $post = array();
  167.             $post['action'] = $_POST['action'];
  168.             $post['code'] = $_POST['code'];
  169.             $post['pass'] = $_POST['password'];
  170.             $this->cookie = decrypt(urldecode($_POST['cookie']));
  171.             $page = $this->GetPage($post_url, $this->cookie, $post, $this->link."\r\nX-Requested-With: XMLHttpRequest");
  172.         } else {
  173.             $this->page = $this->GetPage($this->link, $this->cookie, 0, $this->link);
  174.             is_present($this->page, 'Your account premium traffic has been limited');
  175.             if (preg_match('@https?://([^/\r\n\"\'<>\s\t]+\.)?uploading\.com/get_file/[^\r\n\"\'<>\s\t]+@i', $this->page, $dl)) { //this for direct link file
  176.                 $this->RedirectDownload($dl[0], 'UP_premium', $this->cookie, 0, $this->link);
  177.                 return; // T8: return is better :D
  178.             } else {
  179.                 if (!preg_match('@code: "([^"]+)",@', $this->page, $cd)) html_error("Error: Link id not found.");
  180.  
  181.                 if (stripos($this->page, 'data-pass="true"') !== false) {
  182.                     $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
  183.                     $data['action'] = 'get_link';
  184.                     $data['code'] = $cd[1];
  185.                     $data['step'] = 'passpre';
  186.                     $this->EnterPassword($data);
  187.                     exit();
  188.                 } else { // no password
  189.                     $post['action'] = 'get_link';
  190.                     $post['code'] = $cd[1];
  191.                     $post['pass'] = 'false';
  192.                     $page = $this->GetPage($post_url, $this->cookie, $post, $this->link."\r\nX-Requested-With: XMLHttpRequest");
  193.                 }
  194.             }
  195.         }
  196.         $json = $this->Get_Reply($page);
  197.         if (!empty($json['error'])) html_error('Error at download: '.$json['error']);
  198.  
  199.         if (!preg_match($this->DLregexp, $json['answer']['link'], $dl)) {
  200.             $page = $this->GetPage($json['answer']['link'], $this->cookie);
  201.             if (preg_match('@https?://(?:[\w\-]+\.)*uploading\.com/files/(?:acc_)?thankyou/[^\s\"\'<>]+@i', $page, $redir)) {
  202.                 $this->cookie = GetCookiesArr($page, $this->cookie);
  203.                 $page = $this->GetPage(str_ireplace('/acc_thankyou/', '/thankyou/', $redir[0]), $this->cookie);
  204.             }
  205.             if (!preg_match($this->DLregexp, $page, $dl)) html_error('Download-link not found.');
  206.         }
  207.  
  208.         //$filename = basename(parse_url($json['answer']['link'], PHP_URL_PATH));
  209.         $this->RedirectDownload($dl[0], 'UP_premium', $this->cookie);
  210.     }
  211.  
  212.     private function EnterPassword($inputs) {
  213.         if (!is_array($inputs)) html_error('Error parsing password data.');
  214.         echo "\n<center><form action='{$GLOBALS['PHP_SELF']}' method='POST' >\n";
  215.         foreach ($inputs as $name => $input) echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  216.         echo "<h4>Enter password here: <input type='text' name='password' id='filepass' size='13' />&nbsp;&nbsp;<input type='submit' onclick='return check()' value='Submit' /></h4>\n<script type='text/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</form></center>\n";
  217.         include(TEMPLATE_DIR.'footer.php');
  218.         exit();
  219.     }
  220.  
  221.     public function CheckBack($header) {
  222.         is_present($header, 'HTTP/1.1 302 Moved', urldecode(cut_str($header, "Set-Cookie: error=", ";")));
  223.     }
  224. }
  225.  
  226. /*
  227.  * Written by Ruud v.Tony 10-02-2012
  228.  * Premium Dl and Login fixed by Th3-822 14-03-2012
  229.  * Premium Dl after new template fixed by IndoLeech.Com 21-05-2012
  230.  * Free DL, Login and Premium DL fixed by Th3-822 05-07-2012
  231.  * Free DL and Premium DL links/filenames fixed by Th3-822 01-09-2012
  232.  * Free DL fixed by Th3-822 24-3-2014
  233.  */
  234.  
  235. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement