PageRenderTime 103ms CodeModel.GetById 60ms app.highlight 11ms RepoModel.GetById 29ms app.codeStats 1ms

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