PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/hosts/megaupload_com.php

https://github.com/gartz/RapidLeetch
PHP | 169 lines | 167 code | 2 blank | 0 comment | 3 complexity | cad5e800512e87ad22fa5ea011a87e1c MD5 | raw file
  1<?php
  2if (! defined ( 'RAPIDLEECH' )) {
  3	require_once ("index.html");
  4	exit ();
  5}
  6
  7class megaupload_com extends DownloadClass {
  8	
  9	public function Download($link) {
 10		global $premium_acc,$mu_cookie_user_value;
 11		$matches = "";
 12		$Url = parse_url(trim($link));
 13		if (preg_match ( "/f=(\w+)/", $Url ["query"], $matches )) {
 14			$page = $this->GetPage("http://www.megaupload.com/xml/folderfiles.php?folderid=" . $matches [1]);
 15			if (! preg_match_all ( "/url=\"(http[^\"]+)\"/", $page, $matches )) html_error ( 'link not found' );
 16			
 17			if (! is_file ( "audl.php" )) html_error ( 'audl.php not found' );
 18			echo "<form action=\"audl.php?GO=GO\" method=post>\n";
 19			echo "<input type=hidden name=links value='" . implode ( "\r\n", $matches [1] ) . "'>\n";
 20			foreach ( array ( "useproxy", "proxy", "proxyuser", "proxypass" ) as $v )
 21				echo "<input type=hidden name=$v value=" . $_GET [$v] . ">\n";
 22			echo "<script language=\"JavaScript\">void(document.forms[0].submit());</script>\n</form>\n";
 23			flush ();
 24			exit ();
 25		}
 26        if ( ($_REQUEST ["premium_acc"] == "on" && $_REQUEST ["premium_user"] && $_REQUEST ["premium_pass"]) ||
 27			($_REQUEST ["premium_acc"] == "on" && $premium_acc ["megaupload_com"] ["user"] && $premium_acc ["megaupload_com"] ["pass"] ) ||
 28			($mu_cookie_user_value))        
 29		{
 30			$this->DownloadPremium($link);
 31		}else
 32                if( $_POST['pass_pre'] == "ok") { 
 33					global $Referer;
 34					$post ["filepassword"] = $_POST ['password'];
 35					$cookie=$_POST['cookie'];
 36					$page = $this->GetPage($link, $cookie, $post, $Referer );
 37					if (stristr($page,'password protected')) 
 38					{
 39						echo  ("<center><font color=red><b>Wrong password .Please re-enter</b></font></center>");
 40						$this->DownloadPremium($link);exit;
 41					} 
 42					is_page($page);
 43					if (stristr ( $page, "Location:" )) {
 44						$Href = trim ( cut_str ( $page, "Location: ", "\n" ) );
 45						$Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
 46						$FileName = basename ( $Url ["path"] );                
 47						$this->RedirectDownload($Href,$FileName,encrypt($premium_cookie));exit;
 48					}
 49                } else {
 50					if( $_POST['pass_free'] == "ok") { 
 51						global $Referer;
 52						$post ["filepassword"] = $_POST ['password'];
 53						$page = $this->GetPage($link, 0, $post, $Referer );
 54						is_page($page);
 55						if (stristr($page,'password protected')) {
 56							echo  ("<center><font color=red><b>Wrong password .Please re-enter</b></font></center>");
 57							$this->DownloadFree($link);
 58							exit;
 59						} 
 60						$countDown = trim ( cut_str ( $page, "count=",";" ) );
 61						insert_timer( $countDown, "<b>Megaupload Free User</b>.","",true );
 62						if (preg_match('/http:\/\/(.*)" class="down_butt1"/', $page, $match)) {
 63							$Href = "http://$match[1]";
 64							$Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
 65							if (! is_array ( $Url )) {
 66							html_error ( "Download link not found", 0 );
 67							}
 68							$FileName = basename ( $Url ["path"] );
 69							$this->RedirectDownload($Href,$FileName);exit;
 70						}
 71					} else {
 72							$this->DownloadFree($link);
 73					}
 74				}
 75	}
 76	private function DownloadFree($link) {
 77         $Referer;
 78
 79		$page = $this->GetPage($link,0,0,$Referer);
 80        is_page($page);
 81
 82		if (stristr($page,'password protected')) {
 83			?>
 84			<form method="post">
 85			<div>The file Megaupload you're trying to download is password protected. Please enter the password to proceed.</div> 
 86			<input type="hidden" name="link" value="<?php echo $link; ?>" />
 87			<input type="hidden" name="pass_free" value="ok" />
 88			<input type="text" name="password" id="password"/><input type="submit" value="Proceed" />
 89			</form>
 90			<?php
 91			exit;
 92        }
 93		//$countDown = trim ( cut_str ( $page, "count=",";" ) );
 94		//insert_timer( $countDown, "<b>Megaupload Free User</b>.","",true );
 95		//
 96		//Don't edit this random $countDown to 0.
 97		$countDown = rand(5, 10);
 98		sleep($countDown);
 99		
100		is_present ( $page, "The file you are trying to access is temporarily unavailable" );
101		
102		preg_match('/http:\/\/(.*)" class="down_butt1"/', $page, $match);
103		if (isset($match[1])) {
104			$Href = 'http://'.$match[1];
105			$Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
106			if (! is_array ( $Url )) {
107				html_error ( "Download link not found", 0 );
108			}
109			$FileName = basename ( $Url ["path"] );
110			$this->RedirectDownload($Href,$FileName);
111			exit ();
112		}
113	}
114	private function DownloadPremium($link) {
115		global $Referer, $premium_acc, $mu_cookie_user_value;
116
117		$post = array ();
118		$post ['login'] = 1;
119		$post ["username"] = $_GET ["premium_user"] ? $_GET ["premium_user"] : $premium_acc ["megaupload_com"] ["user"];
120		$post ["password"] = $_GET ["premium_pass"] ? $_GET ["premium_pass"] : $premium_acc ["megaupload_com"] ["pass"];
121		$page = $this->GetPage('http://www.megaupload.com/?c=login',0,$post,'http://www.megaupload.com');
122		is_page($page);
123		$premium_cookie = GetCookies($page);
124		if ($mu_cookie_user_value) {
125				$premium_cookie = 'user=' . $mu_cookie_user_value;
126		} elseif ($_GET ["mu_acc"] == "on" && $_GET ["mu_cookie"]) {
127				$premium_cookie = 'user=' . $_GET ["mu_cookie"];
128		} elseif (! stristr ( $premium_cookie, "user" )) {
129				html_error ( "Cannot use premium account", 0 );
130		}
131		$page = $this->GetPage($link,$premium_cookie,0,$Referer);
132		is_page ( $page );
133		if (stristr($page,'password protected')) {
134			?>
135			<form method="post">
136			<div>The file Megaupload you're trying to download is password protected. Please enter the password to proceed.</div> 
137			<input type="hidden" name="link" value="<?php echo $link; ?>" />
138			<input type="hidden" name="cookie" value="<?php echo $premium_cookie;?>" />
139			<input type="hidden" name="pass_pre" value="ok" />
140			<input type="text" name="password" id="password"/><input type="submit" value="Proceed" />
141			</form>
142			<?php
143			exit;
144		}
145						
146        if (stristr ( $page, "Location:" )) {
147			$Href = trim ( cut_str ( $page, "Location: ", "\n" ) );
148			$Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
149			$FileName = basename ( $Url ["path"] );                
150			$this->RedirectDownload($Href,$FileName,encrypt($premium_cookie));
151        } elseif ($page = cut_str ( $page, 'class="down_ad_pad1">', '" class="down_ad_butt1"' )) {
152			$Href = cut_str ( $page, 'href="', '"' );
153			$Referer = $link;
154			$Url = parse_url ( html_entity_decode($Href, ENT_QUOTES, 'UTF-8') );
155			$FileName = basename ( $Url ["path"] );                
156			$this->RedirectDownload($Href,$FileName,encrypt($premium_cookie));
157        } else {
158			html_error ( "Download link not found", 0 );
159        }
160	}
161}
162
163// Updated by rajmalhotra on 10 Jan 2010 MegaUpload captcha is downloaded on server, then display
164// Fixed by rajmalhotra on 20 Jan 2010 Fixed for Download link not found in happy hour
165// Fixed by VinhNhaTrang 13.10.2010
166// Fixed by VinhNhaTrang 30.11.2010
167// Fixed by thangbom40000 on 2010.12.1, Fix for free user and premium download, no wait time, no capcha with free user.
168// Fixed by thangbom40000 on 2010.12.2, Fix premium account can't login.
169 ?>