DL_regexp = '@https?://dc\d+\.4shared\.com/download/[^/\"\'\s<>]+/(?:tsid[^/\"\'\s<>]+/)?[^/\"\'\s<>]+@i'; $this->cookie = array('4langcookie' => 'en'); $this->noTrafficFreeDl = true; // Set to true to switch to free download when premium traffic used is over the limit. $this->link = str_ireplace('.com/get/', '.com/file/', $link); $this->page = $this->GetPage($this->link, $this->cookie); $this->cookie = GetCookiesArr($this->page, $this->cookie); is_present($this->page, 'The file link that you requested is not valid.'); is_present($this->page, 'The file is suspected of illegal or copyrighted content.'); is_present($this->page, 'This file is no longer available because it\'s identical to file banned because of claim.'); // MD5 banned if ($_REQUEST['premium_acc'] == 'on' && ((!empty($_REQUEST['premium_user']) && !empty($_REQUEST['premium_pass'])) || (!empty($premium_acc['4shared_com']['user']) && !empty($premium_acc['4shared_com']['pass'])))) { $this->pA = (!empty($_REQUEST['premium_user']) && !empty($_REQUEST['premium_pass']) ? true : false); return $this->login(); } else return $this->FreeDownload(); } private function FreeDownload() { $this->CheckForPass(); // Direct link downloadable without login or countdown... if (preg_match($this->DL_regexp, $this->page, $DL)) { if (preg_match('/[\?&]dirPwdVerified=(\w+)/i', $this->link, $pwd)) $DL[0] .= '&dirPwdVerified='.$pwd[1]; return $this->RedirectDownload($DL[0], urldecode(basename(parse_url($DL[0], PHP_URL_PATH))), $this->cookie); } if (!preg_match('@\.com/[^/]+/([^/]+)/?(.*)@i', $this->link, $L)) html_error('Invalid link?'); $getLink = "http://www.4shared.com/get/{$L[1]}/{$L[2]}"; $page = $this->GetPage("http://www.4shared.com/get/{$L[1]}/{$L[2]}", $this->cookie); $GLOBALS['Referer'] = $getLink; if (!preg_match($this->DL_regexp, $page, $DL)) html_error('Download-link not found.'); $this->cookie = GetCookiesArr($page, $this->cookie); $dllink = $DL[0]; if (preg_match('/[\?&]dirPwdVerified=(\w+)/i', $this->link, $pwd)) $dllink .= '&dirPwdVerified='.$pwd[1]; if (!preg_match('@id="secondsLeft"[\s\t]+value="(\d+)"@i', $page, $count) && !preg_match('@id="downloadDelayTimeSec"[^<>/]*>(\d+)<@i', $page, $count)) html_error('Timer not found.'); $FileName = urldecode(basename(parse_url($dllink, PHP_URL_PATH))); if ($count[1] <= 120) $this->CountDown($count[1]); else { $data = $this->DefaultParamArr($dllink, encrypt($this->cookie)); $data['filename'] = urlencode($FileName); $data['host'] = $url['host']; $data['port'] = $url['port']; $data['path'] = urlencode($url['path'] . ($url['query'] ? '?' . $url['query'] : '')); $data['saveto'] = $_GET['path']; $this->JSCountdown($count[1], $data); } $this->RedirectDownload($dllink, $FileName, $this->cookie); } private function CheckForPass($predl=false) { global $PHP_SELF; if (isset($_GET['step']) && $_GET['step'] == '1') { $post = array(); $post['userPass2'] = $_POST['userPass2']; $post['dsid'] = trim($_POST['dsid']); $this->page = $this->GetPage($this->link, $this->cookie, $post, $this->link); is_present($this->page, 'Please enter a password to access this file', 'The password you have entered is not valid.'); } elseif (stristr($this->page, 'Please enter a password to access this file')) { echo "\n