PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/hosts/download/megaupload_com.php

https://github.com/gartz/RapidLeetch
PHP | 141 lines | 138 code | 2 blank | 1 comment | 3 complexity | b9b1db071e79b2f1d40814c196361bc1 MD5 | raw file
  1. <?php
  2. if (! defined ( 'RAPIDLEECH' )) {
  3. require_once ("index.html");
  4. exit ();
  5. }
  6. class megaupload_com extends DownloadClass {
  7. public function Download($link) {
  8. global $premium_acc, $mu_cookie_user_value;
  9. //Get link folder
  10. $matches = "";
  11. $Url = parse_url(trim($link));
  12. if (preg_match ( "/f=(\w+)/", $Url ["query"], $matches )) {
  13. $page = $this->GetPage("http://www.megaupload.com/xml/folderfiles.php?folderid=" . $matches [1]);
  14. if (! preg_match_all ( "/url=\"(http[^\"]+)\"/", $page, $matches )) html_error ( 'link not found' );
  15. if (! is_file ( "audl.php" )) html_error ( 'audl.php not found' );
  16. echo "<form action=\"audl.php?GO=GO\" method=post>\n";
  17. echo "<input type=hidden name=links value='" . implode ( "\r\n", $matches [1] ) . "'>\n";
  18. foreach ( array ( "useproxy", "proxy", "proxyuser", "proxypass" ) as $v )
  19. echo "<input type=hidden name=$v value=" . $_GET [$v] . ">\n";
  20. echo "<script language=\"JavaScript\">void(document.forms[0].submit());</script>\n</form>\n";
  21. flush ();
  22. exit ();
  23. }
  24. //Redirect
  25. if ( ($_REQUEST ["premium_acc"] == "on" && $_REQUEST ["premium_user"] && $_REQUEST ["premium_pass"]) ||
  26. ($_REQUEST ["premium_acc"] == "on" && $premium_acc ["megaupload_com"] ["user"] && $premium_acc ["megaupload_com"] ["pass"] ) ||
  27. ($mu_cookie_user_value))
  28. {
  29. $this->DownloadPremium($link);
  30. } else {
  31. $this->DownloadFree($link);
  32. }
  33. }
  34. private function DownloadFree($link) {
  35. global $Referer;
  36. $post = array();
  37. //Get password
  38. $arr = explode("|", $link);
  39. if (count($arr)>=2) {
  40. $link = $arr[0];
  41. $post ["filepassword"] = $arr[1];
  42. }
  43. $page = $this->GetPage($link, 0, $post, $Referer);
  44. is_page($page);
  45. if (stristr($page,'password protected')) {
  46. html_error("Password is incorrect! Input link with password: Link|Password.");
  47. exit;
  48. }
  49. //$countDown = trim ( cut_str ( $page, "count=",";" ) );
  50. //insert_timer( $countDown, "<b>Megaupload Free User</b>.","",true );
  51. $countDown = rand(5, 10);
  52. sleep($countDown);
  53. is_present ( $page, "The file you are trying to access is temporarily unavailable" );
  54. preg_match('/http:\/\/(.*)" class="down_butt1"/', $page, $match);
  55. if (isset($match[1])) {
  56. $Href = 'http://'.$match[1];
  57. $Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
  58. if (! is_array ( $Url )) {
  59. html_error ( "Download link not found", 0 );
  60. }
  61. $FileName = basename ( $Url ["path"] );
  62. $this->RedirectDownload($Href,$FileName);
  63. exit ();
  64. }
  65. }
  66. private function DownloadPremium($link) {
  67. global $Referer, $premium_acc, $mu_cookie_user_value;
  68. $post = array();
  69. $post ['login'] = 1;
  70. $post ["username"] = $_GET ["premium_user"] ? $_GET ["premium_user"] : $premium_acc ["megaupload_com"] ["user"];
  71. $post ["password"] = $_GET ["premium_pass"] ? $_GET ["premium_pass"] : $premium_acc ["megaupload_com"] ["pass"];
  72. $page = $this->GetPage('http://www.megaupload.com/?c=login',0,$post,'http://www.megaupload.com');
  73. is_page($page);
  74. if ($premium_cookie = cut_str($page, 'user=', ';') ) {
  75. $premium_cookie = 'user=' . $premium_cookie;
  76. } elseif ($mu_cookie_user_value) {
  77. $premium_cookie = 'user=' . $mu_cookie_user_value;
  78. } elseif ($_GET ["mu_acc"] == "on" && $_GET ["mu_cookie"]) {
  79. $premium_cookie = 'user=' . $_GET ["mu_cookie"];
  80. } elseif (! stristr ( $premium_cookie, "user" )) {
  81. html_error ( "Cannot use premium account", 0 );
  82. }
  83. //Get password
  84. $post = array();
  85. $arr = explode("|", $link);
  86. if (count($arr)>=2) {
  87. $link = $arr[0];
  88. $post ["filepassword"] = $arr[1];
  89. }
  90. $page = $this->GetPage($link,$premium_cookie,$post,$Referer);
  91. is_page ( $page );
  92. if (stristr($page,'password protected')) {
  93. html_error("Password is incorrect! Input link with password: LINK|PASSWORD.");
  94. exit;
  95. }
  96. if (stristr ( $page, "Location:" )) {
  97. //Premium with Direct active
  98. $Href = trim ( cut_str ( $page, "Location: ", "\n" ) );
  99. $Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
  100. $FileName = basename ( $Url ["path"] );
  101. $this->RedirectDownload($Href,$FileName,encrypt($premium_cookie));
  102. } elseif (preg_match('/http:\/\/(.*)" class="down_ad_butt1"/', $page, $match)) {
  103. //Premium with Direct disable
  104. $Href = "http://" . $match[1];
  105. $Referer = $link;
  106. $Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
  107. $FileName = basename ( $Url ["path"] );
  108. $this->RedirectDownload($Href,$FileName,encrypt($premium_cookie));
  109. } elseif (preg_match('/http:\/\/(.*)" class="down_butt1"/', $page, $match)) {
  110. //Free account - member
  111. echo "<div>Using free acoount - You're member</div>";
  112. $Href = "http://" . $match[1];
  113. $Referer = $link;
  114. $Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
  115. $FileName = basename ( $Url ["path"] );
  116. $this->RedirectDownload($Href,$FileName,encrypt($premium_cookie));
  117. } else {
  118. html_error ("Download link not found", 0);
  119. }
  120. }
  121. }
  122. // Updated by rajmalhotra on 10 Jan 2010 MegaUpload captcha is downloaded on server, then display
  123. // Fixed by rajmalhotra on 20 Jan 2010 Fixed for Download link not found in happy hour
  124. // Fixed by VinhNhaTrang 13.10.2010
  125. // Fixed by VinhNhaTrang 30.11.2010
  126. // Fixed by thangbom40000 on 2010.12.1, Fix for free user and premium download, no wait time, no capcha with free user.
  127. // Fixed by thangbom40000 on 2010.12.4, Fix input link with password: LINK|PASSWORD
  128. ?>