PageRenderTime 25ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/pluginz/download/uploading_com.php

http://rapidleech36b.googlecode.com/
PHP | 274 lines | 247 code | 15 blank | 12 comment | 57 complexity | f67a1ef9283f6cb3c5c29f5a55807b3d MD5 | raw file
  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. if (!$_REQUEST['step']) {
  10. $this->page = $this->GetPage($link);
  11. is_present($this->page, "The requested file is not found");
  12. $this->cookie = GetCookiesArr($this->page);
  13. if (empty($this->cookie['SID'])) html_error("Error: Cookie [SID] not found!");
  14. }
  15. $this->link = $link;
  16. if (($_REQUEST["upl_acc"] == "on" && (!empty($_GET["upl_cookie"]) || !empty($_GET["upl_hash"]))) || ($_REQUEST['premium_acc'] == 'on' && !empty($premium_acc["uploading_com"]["cookie"]))) {
  17. if (!empty($_GET["upl_cookie"])) {
  18. $cookie = $_GET["upl_cookie"];
  19. } elseif (!empty($_GET["upl_hash"])) {
  20. $cookie = strrev(dcd($_GET["upl_hash"]));
  21. } else {
  22. $cookie = $premium_acc["uploading_com"]["cookie"];
  23. }
  24. $this->changeMesg($L->say['_retrieving'] . "<br />Uploading.com Premium Download [Cookie]");
  25. return $this->Login();
  26. } elseif (($_REQUEST['premium_acc'] == 'on' && (($_REQUEST['premium_user'] && $_REQUEST['premium_pass']) || (!empty($premium_acc['uploading_com']['user']) && !empty($premium_acc['uploading_com']['pass']))))) {
  27. $this->changeMesg($L->say['_retrieving'] . "<br />Uploading.com Premium Download");
  28. return $this->Login();
  29. } elseif ($_REQUEST['step'] == 'captcha') {
  30. return $this->Login(true);
  31. } elseif ($_REQUEST['step'] == 'passpre') {
  32. return $this->Premium(true);
  33. } else {
  34. $this->changeMesg($L->say['_retrieving'] . "<br />Uploading.com Free Download");
  35. return $this->Free();
  36. }
  37. }
  38. private function Free() {
  39. if ($_REQUEST['step'] == 'passfree') {
  40. $post['action'] = $_POST['action'];
  41. $post['file_id'] = $_POST['file_id'];
  42. $post['code'] = $_POST['code'];
  43. $post['pass'] = $_POST['password'];
  44. $Url = urldecode($_POST['link']);
  45. $this->cookie = StrToCookies(urldecode($_POST['cookie']));
  46. $check = $this->GetPage($Url, $this->cookie, $post, $this->link);
  47. } else {
  48. is_present($this->page, "The file owner set up a limitation<br />that only premium members are<br />able download this file.");
  49. is_present($this->page, "Sorry, you have reached your daily download limit.<br />Please try again tomorrow or acquire a premium membership.");
  50. $form = cut_str($this->page, '<div class="page inner_content pageDownloadAvm">', '<div class="fixer"></div>');
  51. if (!preg_match('%<form action="([^"]+)" method="post" id="downloadform">%', $form, $fl)) html_error("Error [Post Link FREE not found!]");
  52. $Url = trim($fl[1]);
  53. if (!preg_match_all('@<input type="hidden" name="([^"]+)" value="([^"]+)" \/>@', $form, $c)) html_error('Error [Post Data 1 FREE not found!]');
  54. $match = array_combine($c[1], $c[2]);
  55. if (strpos($this->page, 'Please Enter Password')) {
  56. $data = array_merge($this->DefaultParamArr($Url, $this->cookie), $match);
  57. $data['step'] = 'passfree';
  58. $this->EnterPassword($data);
  59. exit();
  60. }
  61. $post = array();
  62. foreach ($match as $key => $value) {
  63. $post[$key] = $value;
  64. }
  65. $check = $this->GetPage($Url, $this->cookie, $post, $this->link);
  66. }
  67. // Dont use the existing variable cookie name, uploading.com give error message from cookie
  68. $cookie = GetCookiesArr($check, $this->cookie);
  69. if (!empty($cookie['error'])) {
  70. echo ("<center><font color='red'><b>" . urldecode($cookie['error']) . "</b></font></center>");
  71. // use previous cookie variable as it need to be checked again...
  72. $data = $this->DefaultParamArr($Url, $this->cookie);
  73. $data['action'] = $_POST['action'];
  74. $data['file_id'] = $_POST['file_id'];
  75. $data['code'] = $_POST['code'];
  76. $data['step'] = 'passfree';
  77. $this->EnterPassword($data);
  78. exit();
  79. }
  80. if (!preg_match('%<strong id="timer_count">(\d+)</strong>%', $check, $wait)) html_error("Error [Timer not found!]");
  81. $this->CountDown($wait[1]);
  82. if (!preg_match('@action: \'([^\']+)\',@', $check, $act) || !preg_match('@code: "([^"]+)",@', $check, $cd)) html_error("Error [Post Data 2 FREE not found!]");
  83. if (preg_match('%<input type="hidden" value="([^"]+)" id="pass" \/>%', $check, $pasid)) $pass_id = trim($pasid[1]);
  84. else $pass_id = 'undefined';
  85. unset($post);
  86. $post['action'] = $act[1];
  87. $post['code'] = $cd[1];
  88. $post['pass'] = $pass_id;
  89. $this->page = $this->GetPage("http://uploading.com/files/get/?SID={$cookie['SID']}&JsHttpRequest=" . jstime() . "-xml", $cookie, $post, $Url);
  90. if (!preg_match('@"js":\{"(\w+)":\{?"([^"]+)"?:?"?([^|\r|\n|"]+)?"\}@i', $this->page, $match)) html_error("Error [Post Page Response (FREE) UNKNOWN!]");
  91. switch ($match[1]) {
  92. case 'answer':
  93. if ($match[2] == 'link') {
  94. $dlink = str_replace('\\', '', $match[3]);
  95. $filename = basename(parse_url($dlink, PHP_URL_PATH));
  96. $this->RedirectDownload($dlink, $filename, $cookie, 0, $Url);
  97. exit();
  98. }
  99. break;
  100. }
  101. is_present($match[1], 'error', str_replace('\\', '', $match[2]));
  102. }
  103. private function Login($captcha = false) {
  104. global $premium_acc;
  105. if ($_REQUEST["upl_acc"] == "on") {
  106. if (!empty($_REQUEST["upl_cookie"])) $usecookie = $_REQUEST["upl_cookie"];
  107. } elseif (!empty($premium_acc["uploading_com"]['cookie'])) {
  108. $usecookie = $premium_acc["uploading_com"]['cookie'];
  109. } else {
  110. $usecookie = false;
  111. }
  112. $posturl = 'http://uploading.com/';
  113. if (!$usecookie) {
  114. $email = ($_REQUEST["premium_user"] ? trim($_REQUEST["premium_user"]) : $premium_acc ["uploading_com"] ["user"]);
  115. $password = ($_REQUEST["premium_pass"] ? trim($_REQUEST["premium_pass"]) : $premium_acc ["uploading_com"] ["pass"]);
  116. // This check is important incase there's conflict in post account data, do look in the bracket at error message...
  117. if (empty($email) || empty($password)) html_error("Login failed, email[$email] or password[$password] is empty!");
  118. $post['email'] = $_REQUEST["premium_user"] ? trim($_REQUEST["premium_user"]) : $premium_acc ["uploading_com"] ["user"];
  119. $post['password'] = $_REQUEST["premium_user"] ? trim($_REQUEST["premium_user"]) : $premium_acc ["uploading_com"] ["pass"];
  120. if ($captcha == true) {
  121. $post['remember'] = "1";
  122. $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
  123. $post['recaptcha_response_field'] = $_POST['recaptcha_response_field'];
  124. $loginurl = urldecode($_POST['referer']);
  125. $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
  126. } else {
  127. $post['remember'] = "on";
  128. $loginurl = $posturl . "general/login_form/?SID={$this->cookie['SID']}&JsHttpRequest=" . jstime() . "-xml";
  129. }
  130. $check = $this->GetPage($loginurl, $this->cookie, $post, $posturl);
  131. if (!preg_match('@"js":\{"(\w+)":\{?"([^"]+)"?:?(\w+)?\}?@', $check, $match)) html_error("Error [Login Page Response UNKNOWN!]");
  132. switch ($match[1]) {
  133. case 'answer':
  134. if ($match[2] == 'captcha' && $match[3] == 'true') {
  135. // UNCOMMENT THIS CODE BELOW TO CHECK POST DATA HAVE CORRECT
  136. // textarea($post, 0, 0, true);
  137. if (!preg_match('@\(\'recaptcha_block\', \'([^\']+)\'\);@', $this->page, $c)) html_error("Error[CAPTCHA Data not found!]");
  138. $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)), $loginurl);
  139. $data['step'] = 'captcha';
  140. $this->Show_reCaptcha($c[1], $data);
  141. exit();
  142. }
  143. break;
  144. case 'redirect':
  145. $cba = str_replace('\\', '', $match[2]);
  146. if ($cba !== 'http://uploading.com/') html_error('This Account Has Been Blocked/Banned/Expired!');
  147. $this->cookie = GetCookiesArr($check, $this->cookie);
  148. // GET YOUR PREMIUM COOKIE IF YOU WANT TO USE THAT AS LOGIN...DO REMEMBER DO NOT USE COOKIE OR ACCOUNT(USER & PASS) IN THE SAME ACCOUNT.PHP, USE ONLY ONE!
  149. // UNCOMMENT THIS LINE BELOW
  150. // textarea($this->cookie['remembered_user'], 0, 0, true);
  151. break;
  152. }
  153. is_present($match[1], "error", str_replace('\\', '', $match[2]));
  154. } else {
  155. $this->cookie['remembered_user'] = $usecookie;
  156. }
  157. $check = $this->GetPage($posturl . "profile", $this->cookie, 0, $posturl);
  158. $this->cookie = GetCookiesArr($check, $this->cookie);
  159. is_present($check, "<dd>Basic (<a href=\"http://uploading.com/premium/\">Upgrade</a>)</dd>", "Account Type: FREE!");
  160. if (!array_key_exists('cache', $this->cookie)) html_error('Invalid Account!');
  161. return $this->Premium();
  162. }
  163. private function Premium($password = false) {
  164. if ($password == true) {
  165. $post['action'] = $_POST['action'];
  166. $post['code'] = $_POST['code'];
  167. $post['pass'] = $_POST['password'];
  168. $Url = urldecode($_POST['link']);
  169. $this->cookie = decrypt(urldecode($_POST['cookie']));
  170. $page = $this->GetPage($Url, $this->cookie, $post, $this->link);
  171. } else {
  172. $this->page = $this->GetPage($this->link, $this->cookie, 0, $this->link);
  173. is_present($this->page, 'Your account premium traffic has been limited');
  174. if (preg_match('@Location: (http(s)?:\/[^\r\n]+)@i', $this->page, $dl)) { //this for direct link file
  175. $dlink = trim($dl[1]);
  176. $filename = basename(parse_url($dlink, PHP_URL_PATH));
  177. $this->RedirectDownload($dlink, $filename, $this->cookie, 0, $this->link);
  178. exit(); //must use this or not???
  179. } else {
  180. if (!preg_match('@action: \'([^\']+)\',@', $this->page, $act) || !preg_match('@code: "([^"]+)",@', $this->page, $cd)) html_error("Error [Post Data - PREMIUM not found!]");
  181. $Url = "http://uploading.com/files/get/?SID={$this->cookie['SID']}&JsHttpRequest=" . jstime() . "-xml";
  182. if (strpos($this->page, 'Please Enter Password')) {
  183. $data = $this->DefaultParamArr($Url, encrypt(CookiesToStr($this->cookie)));
  184. $data['action'] = $act[1];
  185. $data['code'] = $cd[1];
  186. $data['step'] = 'passpre';
  187. $this->EnterPassword($data);
  188. exit();
  189. } else { // no password
  190. $post['action'] = $act[1];
  191. $post['code'] = $cd[1];
  192. $post['pass'] = 'undefined';
  193. $page = $this->GetPage($Url, $this->cookie, $post, $this->link);
  194. }
  195. }
  196. }
  197. if (!preg_match('@"js":\{"(\w+)":\{?"([^"]+)"?:?"?([^|\r|\n|"]+)?"\}@', $page, $match)) html_error("Error [Unknown Post Data (PREMIUM) Page Response!]");
  198. switch ($match[1]) {
  199. case 'error':
  200. echo ("<center><font color='red'><b>$match[2]</b></font></center>");
  201. $data = $this->DefaultParamArr($Url, encrypt($this->cookie));
  202. $data['action'] = $_POST['action'];
  203. $data['code'] = $_POST['code'];
  204. $data['step'] = 'passpre';
  205. $this->EnterPassword($data);
  206. break;
  207. case 'answer':
  208. if ($match[2] == 'link') {
  209. $dlink = str_replace('\\', '', $match[3]);
  210. $filename = basename(parse_url($dlink, PHP_URL_PATH));
  211. $this->RedirectDownload($dlink, $filename, $this->cookie, 0, $Url);
  212. }
  213. break;
  214. }
  215. }
  216. private function Show_reCaptcha($pid, $inputs) {
  217. global $PHP_SELF;
  218. if (!is_array($inputs)) {
  219. html_error("Error parsing captcha data.");
  220. }
  221. // Themes: 'red', 'white', 'blackglass', 'clean'
  222. echo "<script language='JavaScript'>var RecaptchaOptions={theme:'white', lang:'en'};</script>\n";
  223. echo "\n<center><form name='dl' action='$PHP_SELF' method='post' ><br />\n";
  224. foreach ($inputs as $name => $input) {
  225. echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  226. }
  227. echo "<script type='text/javascript' src='http://www.google.com/recaptcha/api/challenge?k=$pid'></script>";
  228. echo "<noscript><iframe src='http://www.google.com/recaptcha/api/noscript?k=$pid' height='300' width='500' frameborder='0'></iframe><br />";
  229. echo "<textarea name='recaptcha_challenge_field' rows='3' cols='40'></textarea><input type='hidden' name='recaptcha_response_field' value='manual_challenge' /></noscript><br />";
  230. echo "<input type='submit' name='submit' onclick='javascript:return checkc();' value='Enter Captcha' />\n";
  231. echo "<script type='text/javascript'>/*<![CDATA[*/\nfunction checkc(){\nvar capt=document.getElementById('recaptcha_response_field');\nif (capt.value == '') { window.alert('You didn\'t enter the image verification code.'); return false; }\nelse { return true; }\n}\n/*]]>*/</script>\n";
  232. echo "</form></center>\n</body>\n</html>";
  233. exit;
  234. }
  235. private function EnterPassword($inputs) {
  236. global $PHP_SELF;
  237. if (!is_array($inputs)) {
  238. html_error("Error parsing password data.");
  239. }
  240. echo "\n" . '<center><form action="' . $PHP_SELF . '" method="post" >' . "\n";
  241. foreach ($inputs as $name => $input) {
  242. echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  243. }
  244. 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";
  245. echo "<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";
  246. echo "\n</form></center>\n</body>\n</html>";
  247. exit();
  248. }
  249. public function CheckBack($header) {
  250. is_present($header, 'HTTP/1.1 302 Moved', urldecode(cut_str($header, "Set-Cookie: error=", ";")));
  251. }
  252. }
  253. /*
  254. * Written by Ruud v.Tony 10-02-2012
  255. */
  256. ?>