PageRenderTime 25ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/hosts/download/depositfiles_com.php

http://rapidleech.googlecode.com/
PHP | 198 lines | 173 code | 13 blank | 12 comment | 51 complexity | 437a994f403027bc98a81cbd72e22e81 MD5 | raw file
  1. <?php
  2. if (!defined('RAPIDLEECH')) {
  3. require_once ("index.html");
  4. exit ();
  5. }
  6. class depositfiles_com extends DownloadClass {
  7. public function Download($link) {
  8. global $premium_acc, $Referer;
  9. if (preg_match('@http:\/\/depositfiles\.com\/folders\/[^|\r|\n]+@i', $link, $dir)) {
  10. if (!$dir[0]) html_error('Invalid depositfiles folder link!');
  11. $page = $this->GetPage($link, "lang_current=en");
  12. preg_match_all('/<a class="hrefs" href="(.*)">/i', $page, $check);
  13. if (!$check[1]) html_error('Can\'t find any depositfiles single link!');
  14. $this->moveToAutoDownloader($check[1]);
  15. }
  16. if ($_POST['step'] == 'password') {
  17. $post['file_password'] = $_POST['file_password'];
  18. $link = urldecode($_POST['link']);
  19. if ($_POST['pass'] == 'premium') {
  20. $cookie = decrypt(urldecode($_POST['cookie']));
  21. return $this->DownloadPremium($link, $cookie, $this->GetPage($link, $cookie, $post, $Referer));
  22. } else {
  23. $cookie = urldecode($_POST['cookie']);
  24. return $this->DownloadFree($link, $cookie, $this->GetPage($link, $cookie, $post, $Referer));
  25. }
  26. } elseif (($_REQUEST["cookieuse"] == "on" && preg_match("/autologin\s?=\s?([^\r\n;);?/i", $_REQUEST["cookie"], $c)) || ($_REQUEST["premium_acc"] == "on" && $premium_acc["depositfiles_com"]["cookie"])) {
  27. $cookie = (empty($c[1]) ? $premium_acc["depositfiles_com"]["cookie"] : $c[1]);
  28. return $this->Login($link, $cap, $cookie);
  29. } elseif (($_REQUEST ["premium_acc"] == "on" && $_REQUEST ["premium_user"] && $_REQUEST ["premium_pass"]) || ($_REQUEST ["premium_acc"] == "on" && $premium_acc ["depositfiles_com"] ["user"] && $premium_acc ["depositfiles_com"] ["pass"])) {
  30. return $this->Login($link, $cap);
  31. } elseif ($_POST['step'] == 'CaptchaPre') {
  32. return $this->Login($link, 1);
  33. } elseif ($_POST['step'] == 'CaptchaFree') {
  34. return $this->DownloadFree($link);
  35. } else {
  36. $page = $this->GetPage($link, "lang_current=en");
  37. $cookie = GetCookies($page) . "; lang_current=en";
  38. return $this->Retrieve($link, $cookie, $this->GetPage($link, $cookie, array('gateway_result' => '1'), $Referer));
  39. }
  40. }
  41. private function Retrieve($link, $cookie, $page) {
  42. global $Referer;
  43. is_present($page, "Such file does not exist or it has been removed for infringement of copyrights.");
  44. is_present($page, "all downloading slots for your country are busy", "All download slots for your country are busy!");
  45. if (preg_match('/Your IP ([\d.]+) is already downloading a file from our system/', $page, $msg)) html_error($msg[0]);
  46. if (preg_match('%html_download_api-limit_interval">(\d+)<\/span>%', $page, $limit)) html_error("Download limit exceeded. Try again in " . round($limit[1] / 60) . " minutes");
  47. if (stristr($page, 'Please, enter the password for this file')) {
  48. $data = array_merge($this->DefaultParamArr($link, $cookie), array('step' => 'password'));
  49. $this->EnterPassword($data);
  50. exit();
  51. }
  52. if (!preg_match('%<span id="download_waiter_remain">(\d+)<\/span>%', $page, $wait)) html_error('Error 0x01:Plugin is out of date');
  53. $this->CountDown($wait[1]);
  54. $cookie = $cookie . '; ' . GetCookies($page);
  55. if (!preg_match("@var fid = '([^|']+)@i", $page, $fid)) html_error('Error 0x02:Plugin is out of date');
  56. if (!preg_match("@Recaptcha\.create\('([^|']+)@i", $page, $cid)) html_error('Error 0x03:Plugin is out of date');
  57. if (!preg_match("@\/get_file\.php[^|']+@i", $page, $temp)) html_error('Error 0x04:Plugin is out of date');
  58. $data = $this->DefaultParamArr("http://depositfiles.com$temp[0]", $cookie);
  59. $data['step'] = 'CaptchaFree';
  60. $data['fid'] = $fid[1];
  61. $data['check'] = $cid[1];
  62. $this->Show_reCaptcha($cid[1], $data);
  63. exit();
  64. }
  65. private function DownloadFree($link) {
  66. global $Referer;
  67. $fid = $_POST['fid'];
  68. $check = $_POST['check'];
  69. $challenge = $_POST['recaptcha_challenge_field'];
  70. $response = $_POST['recaptcha_response_field'];
  71. $link = urldecode($_POST['link']);
  72. $cookie = urldecode($_POST['cookie']);
  73. $page = $this->GetPage($link . "$fid&challenge=$challenge&response=$response", $cookie, 0, $Referer);
  74. if (preg_match("@check_recaptcha\('$fid'@i", $page)) {
  75. $data = $this->DefaultParamArr($link, $cookie);
  76. $data['step'] = 'CaptchaFree';
  77. $data['fid'] = $fid;
  78. $this->Show_reCaptcha($check, $data);
  79. exit();
  80. }
  81. if (!preg_match('%<form action="(.*)" method="get"%U', $page, $dl)) html_error("Error 0x05:Plugin is out of date");
  82. $dlink = trim($dl[1]);
  83. $FileName = basename(parse_url($dlink, PHP_URL_PATH));
  84. $this->RedirectDownload($dlink, $FileName, $cookie, 0, $Referer);
  85. exit();
  86. }
  87. private function Login($link, $cap = 0, $autolog = false) {
  88. global $premium_acc;
  89. $posturl = 'http://depositfiles.com/';
  90. if (!$autolog) {
  91. $user = ($_REQUEST["premium_user"] ? $_REQUEST["premium_user"] : $premium_acc["depositfiles_com"]["user"]);
  92. $pass = ($_REQUEST["premium_pass"] ? $_REQUEST["premium_pass"] : $premium_acc["depositfiles_com"]["pass"]);
  93. if (empty($user) || empty($pass)) html_error("Login Failed: Username[$user] or Password[$pass] is empty. Please check login data.");
  94. $post['go'] = "1";
  95. $post['login'] = $user;
  96. $post['password'] = $pass;
  97. if ($cap == 1) {
  98. $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
  99. $post['recaptcha_response_field'] = $_POST['recaptcha_response_field'];
  100. $loginurl = urldecode($_POST['link']);
  101. } else {
  102. $loginurl = $posturl."login.php?return=/";
  103. }
  104. $page = $this->GetPage($loginurl, "lang_current=en", $post, $posturl);
  105. if (strpos($page, 'Enter security code')) {
  106. if (!preg_match('@api\/challenge[?]k=([^"]+)@i', $page, $cap) && !preg_match('@api\/noscript[?]k=([^"]+)@i', $page, $cap)) html_error('Error [Captcha Data Login not found!]');
  107. $data = $this->DefaultParamArr($loginurl);
  108. $data['step'] = 'CaptchaPre';
  109. $this->Show_reCaptcha($cap[1], $data);
  110. exit();
  111. }
  112. $cookie = GetCookies($page) . '; lang_current=en';
  113. // WANNA GET YOUR PREMIUM COOKIE? UNCOMMENT THE CODE BELOW, COPY THE COOKIE VALUE IN THE TEXTAREA!
  114. // $autolog = cut_str($cookie, 'autologin=', ';');
  115. // textarea($autolog, 0, 0, true);
  116. is_notpresent($cookie, "autologin", "Login Failed , Bad username/password combination");
  117. } else {
  118. $cookie = "autologin=$autolog; lang_current=en";
  119. }
  120. //IMPORTANT, WE NEED TO CHECK THIS FIRST!
  121. $page = $this->GetPage($posturl.'gold/', $cookie, 0, $posturl.'gold/payment.php');
  122. is_present($page, 'FREE - member', 'Account free, login not validated!');
  123. is_notpresent($page, '<div class="goldmembership">', 'Login failed, account is not valid?');
  124. return $this->DownloadPremium($link, $cookie, $this->GetPage($link, $cookie));
  125. }
  126. private function DownloadPremium($link, $cookie, $page) {
  127. is_present($page, "You have exceeded the 20 GB 24-hour limit");
  128. is_present($page, "Such file does not exist or it has been removed for infringement of copyrights.");
  129. if (stristr($page, 'Please, enter the password for this file')) {
  130. $data = array_merge($this->DefaultParamArr($link, encrypt($cookie)), array('step' => 'password', 'pass' => 'premium'));
  131. $this->EnterPassword($data);
  132. exit();
  133. }
  134. if (!preg_match('@http:\/\/.+depositfiles\.com\/auth-[^|\r|\n|\'"]+@i', $page, $dl)) html_error("Error 0x06:Plugin is out of date");
  135. $dlink = trim($dl[0]);
  136. $FileName = basename(parse_url($dlink, PHP_URL_PATH));
  137. $this->RedirectDownload($dlink, $FileName, $cookie);
  138. }
  139. private function Show_reCaptcha($pid, $inputs) {
  140. global $PHP_SELF;
  141. if (!is_array($inputs)) {
  142. html_error("Error parsing captcha data.");
  143. }
  144. // Themes: 'red', 'white', 'blackglass', 'clean'
  145. echo "<script language='JavaScript'>var RecaptchaOptions={theme:'white', lang:'en'};</script>\n";
  146. echo "\n<center><form name='dl' action='$PHP_SELF' method='post' ><br />\n";
  147. foreach ($inputs as $name => $input) {
  148. echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  149. }
  150. echo "<script type='text/javascript' src='http://www.google.com/recaptcha/api/challenge?k=$pid'></script>";
  151. echo "<noscript><iframe src='http://www.google.com/recaptcha/api/noscript?k=$pid' height='300' width='500' frameborder='0'></iframe><br />";
  152. echo "<textarea name='recaptcha_challenge_field' rows='3' cols='40'></textarea><input type='hidden' name='recaptcha_response_field' value='manual_challenge' /></noscript><br />";
  153. echo "<input type='submit' name='submit' onclick='javascript:return checkc();' value='Enter Captcha' />\n";
  154. 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";
  155. echo "</form></center>\n</body>\n</html>";
  156. exit();
  157. }
  158. private function EnterPassword($inputs) {
  159. global $PHP_SELF;
  160. if (!is_array($inputs)) {
  161. html_error("Error parsing password data.");
  162. }
  163. echo "\n" . '<center><form action="' . $PHP_SELF . '" method="post" >' . "\n";
  164. foreach ($inputs as $name => $input) {
  165. echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  166. }
  167. 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";
  168. 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";
  169. echo "\n</form></center>\n</body>\n</html>";
  170. exit();
  171. }
  172. }
  173. //Written by VinhNhaTrang 12-08-2010
  174. //Updated by vdhdevil & Ruud v.Tony 19-3-2011
  175. //Updated by vdhdevil 30-April-2011: Updated Download Premium
  176. //Updated by Ruud v.Tony 16-May-2011: Updated Download Free
  177. //Updated by Ruud v.Tony 03-Okt-2011: Updated for depositfiles new layout, support captcha in login, password protected file, folder file
  178. //Updated by Ruud v.Tony 05-Okt-2011: Updated in password protected files so we dont need to start over the page :D
  179. //Updated by Ruud v.Tony 26-Okt-2011: Add captcha function in free download
  180. ?>