PageRenderTime 27ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/pluginz/download/bulletupload_com.php

http://rapidleech36b.googlecode.com/
PHP | 126 lines | 105 code | 15 blank | 6 comment | 28 complexity | e82e49e8f8e30ea876a82b6b5164a2d4 MD5 | raw file
  1. <?php
  2. if (!defined('RAPIDLEECH')) {
  3. require_once ('index.html');
  4. exit();
  5. }
  6. class bulletupload_com extends DownloadClass {
  7. public function Download($link) {
  8. global $premium_acc;
  9. if (!$_REQUEST['step']) {
  10. $this->page = $this->GetPage($link, "lang=english");
  11. is_present($this->page, "The file you were looking for could not be found, sorry for any inconvenience.");
  12. }
  13. if ($_REQUEST['premium_acc'] == 'on' && (($_REQUEST['premium_user'] && $_REQUEST['premium_pass'])||($premium_acc['bulletupload_com']['user'] && $premium_acc['bulletupload_com']['pass']))) {
  14. return $this->Premium($link);
  15. } else {
  16. return $this->Free($link);
  17. }
  18. }
  19. private function Free($link) {
  20. if ($_REQUEST['down_direct'] == '1') {
  21. $link = urldecode($_POST['link']);
  22. $post = array();
  23. $post['op'] = $_POST['op'];
  24. $post['id'] = $_POST['id'];
  25. $post['rand'] = $_POST['rand'];
  26. $post['referer'] = $link;
  27. $post['method_free'] = $_POST['method_free'];
  28. $post['method_premium'] = '';
  29. $post['recaptcha_challenge_field'] = $_POST['challenge'];
  30. $post['recaptcha_response_field'] = $_POST['captcha'];
  31. $page = $this->GetPage($link, "lang=english", $post, $link);
  32. } else {
  33. $form = cut_str($this->page, '<Form method="POST" action=\'\'>', "</Form>");
  34. if (!preg_match_all('@<input type="hidden" name="([^"]+)" value="([^"]+)?">@', $form, $one) || !preg_match_all('@<input type="submit" name="(\w+_free)" value="([^"]+)" >@', $form, $two)) html_error("Error: Post Data 1 [FREE] not found!");
  35. $match = array_merge(array_combine($one[1], $one[2]), array_combine($two[1], $two[2]));
  36. $post = array();
  37. foreach ($match as $key => $value) {
  38. $post[$key] = $value;
  39. }
  40. $page = $this->GetPage($link, "lang=english", $post, $link);
  41. }
  42. if (strpos($page, "Type the two words:")) {
  43. $form = cut_str($page, '<Form name="F1" method="POST"', '</Form>');
  44. is_present($form, 'Password', 'This file is password protected!');
  45. if (!preg_match('@(\d+)<\/span> seconds@', $form, $wait)) html_error("Error: Timer not found!");
  46. $this->CountDown($wait[1]);
  47. if (!preg_match_all('@<input type="hidden" name="([^"]+)" value="([^"]+)?">@', $form, $match)) html_error("Error: Post Data 2 [FREE] not found!");
  48. if (!preg_match('@\/api\/challenge\?k=([^"]+)">@', $form, $cap)) html_error("Error: Captcha Key found!");
  49. $ch = cut_str($this->GetPage("http://www.google.com/recaptcha/api/challenge?k=$cap[1]"), "challenge : '", "'");
  50. $capt = $this->GetPage("http://www.google.com/recaptcha/api/image?c=" . $ch);
  51. $capt_img = substr($capt, strpos($capt, "\r\n\r\n") + 4);
  52. $imgfile = DOWNLOAD_DIR . "bulletupload_captcha.jpg";
  53. if (file_exists($imgfile)) unlink($imgfile);
  54. if (empty($capt_img) || !write_file($imgfile, $capt_img)) html_error("Error getting CAPTCHA image.", 0);
  55. // Captcha img downloaded
  56. $data = array_merge($this->DefaultParamArr($link), array_combine($match[1], $match[2]));
  57. $data['challenge'] = $ch;
  58. $this->EnterCaptcha($imgfile, $data, 20);
  59. exit();
  60. }
  61. is_present($page, cut_str($page, '<div class="err">', '<br />'));
  62. if (!preg_match('@http:\/\/[\d.]+(:\d+)?\/[^|\r|\n|"]+@', $page, $dl)) html_error("Error: Download Link [FREE] not found!");
  63. $dlink = trim($dl[0]);
  64. $filename = basename(parse_url($dlink, PHP_URL_PATH));
  65. $this->RedirectDownload($dlink, $filename, 0, 0, $link);
  66. exit();
  67. }
  68. private function Premium($link) {
  69. $cookie = $this->login();
  70. $page = $this->GetPage($link, $cookie, 0, $link);
  71. if (!preg_match('/http:\/\/[\w.]+(:\d+)?\/d\/[^\r\n]+/', $page, $dl)) {
  72. $form = cut_str($page, '<Form name="F1" method="POST"', '</Form>');
  73. is_present($form, 'Password', 'This file is password protected!');
  74. if (!preg_match_all('%<input type="hidden" name="([^"]+)" value="([^"]+)?">%', $form, $ck)) html_error('Error [Post Data PREMIUM not found!]');
  75. $match = array_combine($ck[1], $ck[2]);
  76. $post = array();
  77. foreach ($match as $k => $v) {
  78. $post[$k] = $v;
  79. }
  80. $page = $this->GetPage($link, $cookie, $post, $link);
  81. if (!preg_match('/http:\/\/[\w.]+(:\d+)?\/d\/[^\r\n"]+/', $page, $dl)) html_error('Error [Download Link PREMIUM not found!]');
  82. }
  83. $dlink = trim($dl[0]);
  84. $filename = basename(parse_url($dlink, PHP_URL_PATH));
  85. $this->RedirectDownload($dlink, $filename, $cookie, 0, $link);
  86. }
  87. private function login() {
  88. global $premium_acc;
  89. $user = ($_REQUEST["premium_user"] ? trim($_REQUEST["premium_user"]) : $premium_acc ["bulletupload_com"] ["user"]);
  90. $pass = ($_REQUEST["premium_pass"] ? trim($_REQUEST["premium_pass"]) : $premium_acc ["bulletupload_com"] ["pass"]);
  91. if (empty($user) || empty($pass)) html_error("Login failed, $user [user] or $pass [password] is empty!");
  92. $url = 'http://bulletupload.com/';
  93. $post['op'] = 'login';
  94. $post['redirect'] = $url;
  95. $post['login'] = $user;
  96. $post['password'] = $pass;
  97. $page = $this->GetPage($url, 'lang=english', $post, $url."login.html");
  98. is_present($page, cut_str($page, "<b class='err'>", "</b>"));
  99. $cookie = GetCookies($page).'; lang=english';
  100. //check account
  101. $page = $this->GetPage($url."?op=my_account", $cookie, 0, $url);
  102. is_notpresent($page, '<TD>Username:</TD>', 'Invalid account!');
  103. is_notpresent($page, '<TD>Premium account expire:</TD>', 'Account not premium???');
  104. return $cookie;
  105. }
  106. }
  107. /*
  108. * by Ruud v.Tony 28-01-2012
  109. * updated to support premium by Ruud v.Tony 20-02-2012
  110. */
  111. ?>