Beispiel #1
0
 public function Download($link)
 {
     global $premium_acc;
     $this->link = $link = str_ireplace('freakshare.net/', 'freakshare.com/', $link);
     $this->cookie = array();
     $this->DLRegexp = '@https?://\\w+\\.freakshare\\.com/get\\.php\\?dlid=\\w+@i';
     $this->pA = empty($_REQUEST['premium_user']) || empty($_REQUEST['premium_pass']) ? false : true;
     $_POST['step'] = empty($_POST['step']) ? false : $_POST['step'];
     if (empty($_POST['step']) || !in_array($_POST['step'], array('1', '2'))) {
         $this->page = $this->GetPage($this->link, $this->cookie);
         if (stripos($this->page, 'selected="selected">English<') === false) {
             $this->cookie = GetCookiesArr($this->GetPage('http://freakshare.com/index.php?language=EN', $this->cookie), $this->cookie);
             $this->page = $this->GetPage($this->link, $this->cookie);
         }
         is_present($this->page, 'This file does not exist!');
         $this->cookie = GetCookiesArr($this->page, $this->cookie);
     } elseif (!empty($_POST['cookie'])) {
         $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
     }
     if ($_REQUEST['premium_acc'] == 'on' && ($this->pA || !empty($premium_acc['freakshare_com']['user']) && !empty($premium_acc['freakshare_com']['pass']))) {
         return $this->Login($this->pA ? $_REQUEST['premium_user'] : $premium_acc['freakshare_com']['user'], $this->pA ? $_REQUEST['premium_pass'] : $premium_acc['freakshare_com']['pass']);
     } else {
         return $this->FreeDL();
     }
 }
 private function FreeDL()
 {
     if (empty($_POST['step']) || $_POST['step'] != '1') {
         if (!preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w|\\-]+)@i', $this->page, $pid)) {
             $pid = array(1 => '6LcEvs0SAAAAAAykpzcaaxpegnSndWcEWYsSMs0M');
         }
         $data = $this->DefaultParamArr($this->link, empty($this->cookie) ? 0 : encrypt(CookiesToStr($this->cookie)));
         $data['step'] = '1';
         $this->Show_reCaptcha($pid[1], $data);
         exit;
     } else {
         if (empty($_POST['recaptcha_response_field'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         if (!empty($_POST['cookie'])) {
             $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         }
         $query = array();
         $query['type'] = 'recaptcha';
         $query['challenge'] = $_POST['recaptcha_challenge_field'];
         $query['capture'] = $_POST['recaptcha_response_field'];
         $page = $this->GetPage($this->link . '?' . http_build_query($query), $this->cookie);
         $reply = $this->Get_Reply($page);
         if (!empty($reply['err'])) {
             html_error('Error: ' . htmlentities($reply['err']));
         }
         if (empty($reply['href'])) {
             html_error('Error: Download link not found.');
         }
         $this->RedirectDownload($reply['href'], urldecode(basename(parse_url($reply['href'], PHP_URL_PATH))));
     }
 }
Beispiel #3
0
 public function Download($link)
 {
     $this->cookie = isset($_POST['yt_QS']) && !empty($_POST['cookie']) ? StrToCookies(decrypt(urldecode($_POST['cookie']))) : array();
     $url = parse_url($link);
     $this->vid = array();
     if (host_matches('youtu.be', $url['host'])) {
         preg_match('@/([\\w\\-\\.]{11})@i', $url['path'], $this->vid);
     } elseif (empty($url['query']) || ($this->vid[1] = cut_str('&' . $url['query'] . '&', '&v=', '&')) === false || !preg_match('@^[\\w\\-\\.]{11}$@i', $this->vid[1])) {
         preg_match('@/(?:v|(?:embed))/([\\w\\-\\.]{11})@i', $url['path'], $this->vid);
     }
     if (empty($this->vid[1])) {
         html_error('Video ID not found.');
     }
     $this->vid = $this->vid[1];
     $this->link = 'https://www.youtube.com/watch?v=' . $this->vid;
     $this->getFmtMaps();
     $this->fmturlmaps = $this->GetVideosArr();
     $yt_fmt = empty($_REQUEST['yt_fmt']) ? '' : $_REQUEST['yt_fmt'];
     if (empty($yt_fmt) && !isset($_GET['audl'])) {
         return $this->QSelector();
     } elseif (isset($_REQUEST['ytube_mp4']) && $_REQUEST['ytube_mp4'] == 'on' && !empty($yt_fmt)) {
         //look for and download the highest quality we can find?
         if ($yt_fmt == 'highest') {
             foreach ($this->fmts as $fmt) {
                 if (array_key_exists($fmt, $this->fmturlmaps)) {
                     $furl = $this->fmturlmaps[$fmt];
                     break;
                 }
             }
         } elseif (!($furl = $this->fmturlmaps[$yt_fmt])) {
             html_error('Specified video format not found');
         } else {
             $fmt = $yt_fmt;
         }
     } else {
         //just get the one Youtube plays by default (in some cases it could also be the highest quality format)
         $fmt = key($this->fmturlmaps);
         $furl = $this->fmturlmaps[$fmt];
     }
     $ext = '.flv';
     $fmtexts = array('.mp4' => array(18, 22, 37, 38), '.webm' => array(43, 44, 45, 46), '.3gp' => array(36, 17));
     foreach ($fmtexts as $k => $v) {
         if (!is_array($v)) {
             $v = array($v);
         }
         if (in_array($fmt, $v)) {
             $ext = $k;
             break;
         }
     }
     if (empty($this->response['title'])) {
         html_error('No video title found! Download halted.');
     }
     $FileName = str_replace(str_split('\\\\:*?"<>|=;' . "\t\r\n\f"), '_', html_entity_decode(trim($this->response['title']), ENT_QUOTES));
     if (!empty($_REQUEST['cleanname'])) {
         $FileName = preg_replace('@[^ A-Za-z_\\-\\d\\.,\\(\\)\\[\\]\\{\\}&\\!\'\\@\\%\\#]@u', '_', $FileName);
     }
     $FileName .= " [YT-f{$fmt}][{$this->vid}]{$ext}";
     $this->RedirectDownload($furl, $FileName, $this->cookie, 0, 0, $FileName);
 }
Beispiel #4
0
 private function DownloadFree($link)
 {
     $captcha = $_POST['captcha'];
     $challenge = $_POST['challenge'];
     $link = urldecode($_POST['link']);
     $cookie = StrToCookies(urldecode($_POST['cookie']));
     $page = $this->GetPage("{$link}?type=recaptcha&challenge={$challenge}&capture={$captcha}", $cookie, 0, $link, 0, 1);
     $cookie = GetCookiesArr($page, $cookie);
     if (preg_match('@\\{"(\\w+)":(\\w+)?,?"?(\\w+)?"?:?"([^"]+)"\\}@', $page, $ck)) {
         if ($ck[1] == 'ok') {
             switch ($ck[3]) {
                 case 'href':
                     $Url = $link . $ck[4];
                     $page = $this->GetPage($Url, $cookie, 0, $link);
                     if (!preg_match('@http:\\/\\/guest\\d+\\.extabit\\.com\\/[^"]+@', $page, $dl)) {
                         html_error("Error[DownloadLink - FREE] not found!");
                     }
                     $dlink = trim($dl[0]);
                     $filename = basename(parse_url($dlink, PHP_URL_PATH));
                     $this->RedirectDownload($dlink, $filename, $cookie, 0, $link);
                     break;
             }
         }
         is_present($ck[1], 'err', $ck[4]);
     }
 }
Beispiel #5
0
 private function DownloadFree()
 {
     $recap = $_POST['recap'];
     $captcha = $_POST['recaptcha_response_field'];
     $challenge = $_POST['recaptcha_challenge_field'];
     $this->link = urldecode($_POST['link']);
     $this->cookie = StrToCookies(urldecode($_POST['cookie']));
     $page = $this->GetPage("{$this->link}?type=recaptcha&challenge={$challenge}&capture={$captcha}", $this->cookie, 0, $this->link, 0, 1);
     $this->cookie = GetCookiesArr($page, $this->cookie);
     if (preg_match('@\\{"(\\w+)":(\\w+)?,?"?(\\w+)?"?:?"([^"]+)"\\}@', $page, $ck)) {
         switch ($ck[1]) {
             case 'ok':
                 $Url = $this->link . $ck[4];
                 $page = $this->GetPage($Url, $this->cookie, 0, $this->link);
                 if (!preg_match('/https?:\\/\\/guest\\d+\\.extabit\\.com\\/[^\\r\\n\\s\\t"]+/', $page, $dl)) {
                     html_error("Error[DownloadLink - FREE] not found!");
                 }
                 $dlink = trim($dl[0]);
                 $filename = basename(parse_url($dlink, PHP_URL_PATH));
                 $this->RedirectDownload($dlink, $filename, $cookie, 0, $this->link);
                 break;
             case 'err':
                 echo "<center><font color='red'><b>{$ck['4']}</b></font></center>";
                 $data = $this->DefaultParamArr($this->link, $this->cookie);
                 $data['step'] = '1';
                 $data['recap'] = $recap;
                 $this->Show_reCaptcha($recap, $data);
                 break;
         }
         is_present($ck[1], 'err', $ck[4]);
     }
 }
Beispiel #6
0
 private function DownloadFree($link)
 {
     global $Referer;
     if ($_REQUEST['step'] == 'captcha') {
         $post["recaptcha_challenge_field"] = $_POST['recaptcha_challenge_field'];
         $post["recaptcha_response_field"] = $_POST['recaptcha_response_field'];
         $post["id"] = $_POST['id'];
         $cookie = urldecode($_POST['cookie']);
         $dlink = urldecode($_POST['link']);
         $FileName = $_POST['name'];
         $this->RedirectDownload($dlink, $FileName, $cookie, $post, $Referer);
         exit;
     } elseif ($_REQUEST['step'] == 'countdown') {
         $link = urldecode($_POST['link']);
         $cookie = StrToCookies(urldecode($_POST['cookie']));
         $page = $this->GetPage($link, $cookie, 0, $Referer);
     } else {
         $page = $this->GetPage($link);
         is_present($page, 'Requested file is deleted.');
         is_present($page, 'There is another download in progress from your IP. Please try to downloading later.');
         $cookie = GetCookiesArr($page);
         $FileName = trim(str_replace(" ", ".", cut_str($page, 'Download ', ',')));
         // first timer
         if (preg_match('/wf = (\\d+);/', $page, $wait)) {
             $this->CountDown($wait[1]);
         }
         if (preg_match("/u='(.+)'/", $page, $cap)) {
             $link = "http://www.crocko.com{$cap['1']}";
         }
         $page = $this->GetPage($link, $cookie, 0, $Referer);
     }
     //get new timer, then refresh the page
     if (preg_match("/w='(\\d+)'/", $page, $wait)) {
         if ($wait[1] > 100) {
             $data = $this->DefaultParamArr($link, $cookie);
             $data['step'] = 'countdown';
             $this->JSCountdown($wait[1], $data);
         } else {
             $this->CountDown($wait[1]);
             $page = $this->GetPage($link, $cookie, 0, $Referer);
         }
     }
     if (preg_match('%<form  method="post" action="([^"]+)">%', $page, $dl)) {
         $dlink = trim($dl[1]);
         if (!is_array($cookie)) {
             $cookie = StrToCookies($cookie, GetCookiesArr($page));
         } else {
             $cookie = GetCookiesArr($page, $cookie);
         }
         if (!preg_match('/Recaptcha\\.create\\("([^"]+)/i', $page, $cid)) {
             html_error('Can\'t find chaptcha id');
         }
         $data = $this->DefaultParamArr($dlink, $cookie);
         $data['step'] = 'captcha';
         $data['id'] = cut_str($page, 'name="id" value="', '"');
         $data['name'] = $FileName;
         $this->Show_reCaptcha($cid[1], $data);
         exit;
     }
 }
Beispiel #7
0
 private function chkCaptcha()
 {
     if (stripos($this->page, 'Please complete the form below:') === false) {
         return;
     }
     if (!empty($_POST['step']) && $_POST['step'] == '1') {
         if (empty($_POST['recaptcha_response_field'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         $post = array('recaptcha_challenge_field' => $_POST['recaptcha_challenge_field'], 'recaptcha_response_field' => $_POST['recaptcha_response_field']);
         $this->page = $this->GetPage($this->link, $this->cookie, $post);
         if (stripos($this->page, 'You entered an invalid captcha') !== false) {
             echo "\n<span class='htmlerror'><b>You entered an invalid captcha, please try again.</b></span><br />";
             unset($_POST['step']);
             $this->chkCaptcha();
         }
     } else {
         if (!preg_match('@https?://(?:[a-zA-Z\\d\\-]+\\.)*(?:google\\.com/recaptcha/api|recaptcha\\.net)/(?:challenge|noscript)\\?k=([\\w\\.\\-]+)@i', $this->page, $cpid)) {
             html_error('reCaptcha Not Found.');
         }
         $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
         $data['step'] = '1';
         $this->reCAPTCHA($cpid[1], $data);
         exit;
     }
 }
Beispiel #8
0
 private function FreeDL($link)
 {
     if (!empty($_POST['step']) && $_POST['step'] == 1) {
         if (empty($_POST['captcha'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         $this->cookie = !empty($_POST['cookie']) ? StrToCookies(decrypt(urldecode($_POST['cookie']))) : array();
         $this->cookie['lang'] = 'english';
         $post = array('recaptcha_challenge_field' => $_POST['challenge'], 'recaptcha_response_field' => $_POST['captcha']);
         $post['op'] = $_POST['T8']['op'];
         $post['id'] = $_POST['T8']['id'];
         $post['rand'] = $_POST['T8']['rand'];
         $post['referer'] = '';
         $post['method_free'] = $_POST['T8']['method_free'];
         $post['down_script'] = 1;
         $page = $this->GetPage($link, $this->cookie, $post);
         is_present($page, '>Skipped countdown', 'Error: Skipped countdown?.');
         is_present($page, '>Wrong captcha<', 'Error: Wrong Captcha Entered.');
         if (preg_match('@You can download files up to \\d+ [KMG]b only.@i', $page, $err)) {
             html_error('Error: ' . $err[0]);
         }
         if (!preg_match('@https?://[^/\\r\\n\\:]+(?:\\:\\d+)?/(?:(?:files)|(?:dl?))/[^\'\\"\\t<>\\r\\n]+@i', $page, $dlink)) {
             html_error('Error: Download link not found.');
         }
         $FileName = urldecode(basename(parse_url($dlink[0], PHP_URL_PATH)));
         $this->RedirectDownload($dlink[0], $FileName);
     } else {
         $page2 = cut_str($this->page, 'Form method="POST" action=', '</form>');
         //Cutting page
         $post = array();
         $post['op'] = cut_str($page2, 'name="op" value="', '"');
         $post['usr_login'] = empty($this->cookie['xfss']) ? '' : $this->cookie['xfss'];
         $post['id'] = cut_str($page2, 'name="id" value="', '"');
         $post['fname'] = cut_str($page2, 'name="fname" value="', '"');
         $post['referer'] = '';
         $post['method_free'] = urlencode(html_entity_decode(cut_str($page2, 'name="method_free" value="', '"')));
         $page = $this->GetPage($link, $this->cookie, $post);
         if (preg_match('@You have to wait (?:\\d+ \\w+,\\s)?\\d+ \\w+ till next download@', $page, $err)) {
             html_error('Error: ' . $err[0]);
         }
         $page2 = cut_str($page, '<form name="F1" method="POST"', '</form>');
         //Cutting page
         if (!preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w\\.\\-]+)@i', $page, $pid)) {
             html_error('Error: reCAPTCHA not found.');
         }
         if (!preg_match('@<div id="countdown_str"[^>]*>[^<>]+<p>[^<>]*<h2[^>]*>(\\d+)</h2>[^<>]+</p>[^<>]+</div>@i', $page2, $count)) {
             html_error('Countdown not found.');
         }
         $this->CountDown($count[1]);
         $data = $this->DefaultParamArr($link, empty($this->cookie['xfss']) ? 0 : encrypt(CookiesToStr($this->cookie)));
         $data['T8[op]'] = cut_str($page2, 'name="op" value="', '"');
         is_notpresent($data['T8[op]'], 'download', 'Error parsing download post data (2).');
         $data['T8[id]'] = cut_str($page2, 'name="id" value="', '"');
         $data['T8[rand]'] = cut_str($page2, 'name="rand" value="', '"');
         $data['T8[method_free]'] = urlencode(html_entity_decode(cut_str($page2, 'name="method_free" value="', '"')));
         $data['step'] = 1;
         $this->DL_reCaptcha($pid[1], $data);
     }
 }
 private function Free()
 {
     if ($_REQUEST['step'] == '1') {
         $this->link = urldecode($_POST['link']);
         $this->cookie = StrToCookies(urldecode($_POST['cookie']));
         $post = array();
         foreach ($_POST["tmp"] as $k => $v) {
             $post[$k] = $v;
         }
         $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
         $post['recaptcha_response_field'] = $_POST['recaptcha_response_field'];
         $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
     } else {
         $form = cut_str($this->page, '<Form method="POST" action=\'\'>', '</Form>');
         if (!preg_match_all('/<input type="hidden" name="([^"]+)" value="([^"]+)?">/', $form, $match)) {
             html_error('Error[Post Data 1 - FREE not found!]');
         }
         $match = array_combine($match[1], $match[2]);
         $post = array();
         foreach ($match as $k => $v) {
             $post[$k] = $v;
         }
         $post['x'] = rand(11, 70);
         $post['y'] = rand(11, 20);
         $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
     }
     if (stripos($page, 'Type the two words')) {
         $form = cut_str($page, '<Form name="F1" method="POST" action=""', '</Form>');
         if (stripos($form, 'Wrong captcha')) {
             echo "<center><font color='red'><b>Wrong Captcha, Please Retry!</b></font></center>";
         }
         if (!preg_match_all('/<input type="hidden" name="([^"]+)" value="([^"]+)?">/', $form, $match)) {
             html_error('Error[Post Data 2 - FREE not found!]');
         }
         $match = array_combine($match[1], $match[2]);
         if (!preg_match('/\\/recaptcha\\/api\\/challenge\\?k=([^"]+)"/', $form, $c)) {
             html_error('Error[Captcha data not found!]');
         }
         if (!preg_match('/(\\d+)<\\/span> seconds/', $form, $w)) {
             html_error('Error[Timer not found!]');
         }
         $this->CountDown($w[1]);
         $data = $this->DefaultParamArr($this->link, $this->cookie);
         $data['step'] = '1';
         foreach ($match as $k => $v) {
             $data["tmp[{$k}]"] = $v;
         }
         $this->Show_reCaptcha($c[1], $data);
         exit;
     }
     if (!preg_match('/Location: (https?:\\/\\/[^\\r\\n]+)/i', $page, $dl)) {
         html_error('Error[Download Link - FREE not found!]');
     }
     $dlink = trim($dl[1]);
     $filename = basename(parse_url($dlink, PHP_URL_PATH));
     $this->RedirectDownload($dlink, $filename, $this->cookie, 0, $this->link);
     exit;
 }
 private function FreeDL($link)
 {
     if (empty($_POST['step']) || $_POST['step'] != 1) {
         if (preg_match('@/lightbox_block_download\\.php\\?(min=-?\\d+&)?sec=\\d+@i', $this->page)) {
             $page = $this->GetPage('http://uploadhero.com/lightbox_block_download.php', $this->cookie);
             if (!preg_match('@(?:id="minn">(\\d+)</span>[\\r\\n\\s\\r]*)*<span [^<>]*id="secondss">(\\d+)</span>@i', $page, $timer)) {
                 html_error('The last download was performed fewer than 30 minutes, you have to wait.');
             }
             $wait = $timer[2];
             if (!empty($timer[1])) {
                 $wait += $timer[1] * 60;
             }
             $data = $this->DefaultParamArr($link);
             return $this->JSCountDown($wait, $data, 'You have to wait before downloading again');
         }
         if (!preg_match('@<img src="((https?://(?:[^/\\r\\n<>\\"]+\\.)?uploadhero\\.com)?/captchadl\\.php\\?[^\\r\\n<>\\"]+)"@i', $this->page, $cimg)) {
             html_error('Error: CAPTCHA not found.');
         }
         $cimg = empty($cimg[2]) ? 'http://uploadhero.com' . $cimg[1] : $cimg[1];
         //Download captcha img.
         $page = $this->GetPage($cimg, $this->cookie);
         $capt_img = substr($page, strpos($page, "\r\n\r\n") + 4);
         $imgfile = DOWNLOAD_DIR . get_class($this) . '_captcha.jpg';
         if (file_exists($imgfile)) {
             unlink($imgfile);
         }
         if (!write_file($imgfile, $capt_img)) {
             html_error('Error getting CAPTCHA image.');
         }
         $data = $this->DefaultParamArr($link, encrypt(CookiesToStr($this->cookie)));
         $data['step'] = 1;
         $this->EnterCaptcha($imgfile . '?' . time(), $data, 20);
         exit;
     }
     if (empty($_POST['captcha'])) {
         html_error('You didn\'t enter the image verification code.');
     }
     $this->cookie = !empty($_POST['cookie']) ? StrToCookies(decrypt(urldecode($_POST['cookie']))) : array();
     $this->cookie['lang'] = 'en';
     $query = 'code=' . urlencode($_POST['captcha']);
     $page = $this->GetPage($link . (strpos($link, '?') ? '&' : '?') . $query, $this->cookie);
     is_present($page, 'border: solid 1px #c60000;', 'Wrong captcha entered.');
     if (!preg_match('@setTimeout[\\s\\t]*\\([\\r\\n\\s\\t]*function[\\s\\t]*\\(\\)[\\r\\n\\s\\t]*{[\\r\\n\\s\\t]*omfg\\(\\);[\\r\\n\\s\\t]*},[\\s\\t]*(\\d+)[\\s\\t]*\\);@i', $page, $count)) {
         html_error('Countdown not found.');
     }
     $count[1] /= 1000;
     if ($count[1] > 0) {
         $this->CountDown($count[1]);
     }
     if (!preg_match('@https?://[^/\\r\\n\'\\"\\t<>]+/\\?d=[^\\r\\n\'\\"\\t<>]+/[^\\r\\n\'\\"\\t<>]+@i', $page, $dlink)) {
         html_error('Error: Download link not found.');
     }
     $this->RedirectDownload($dlink[0], 'uploadhero_fr');
 }
Beispiel #11
0
 private function AnonDL()
 {
     if (empty($_POST['step']) || $_POST['step'] != '1') {
         $page = $this->GetPage($this->baseurl . '/download/start_timer/' . $this->fid, $this->cookie, 0, $this->link . "\r\nX-Requested-With: XMLHttpRequest");
         $this->cookie = GetCookiesArr($page, $this->cookie);
         $start_timer = $this->json2array($page, 'StartTimer Error');
         if (empty($start_timer) || empty($start_timer['show_timer']) && empty($start_timer['redirect_url'])) {
             if (!empty($start_timer['html'])) {
                 if (preg_match('@Delay between downloads must be not less than \\d+ minutes.\\s+Try again in \\d+ minutes@i', $page, $err)) {
                     html_error("[AnonDL] {$err[0]}");
                 }
                 html_error('Error @ StartTimer: ' . htmlspecialchars(strip_tags($start_timer['html']), ENT_QUOTES));
             } else {
                 //  if (substr($page, 9, 3) == '200')
                 textarea($start_timer);
                 html_error('Unknown error @ StartTimer');
             }
         }
         if (strpos($start_timer['redirect_url'], '://') === false) {
             $start_timer['redirect_url'] = $this->baseurl . $start_timer['redirect_url'];
         }
         if (!empty($start_timer['show_timer']) && $start_timer['timer'] > 0) {
             $this->CountDown($start_timer['timer']);
         }
         $page = $this->GetPage($start_timer['redirect_url'], $this->cookie, 0, $this->link);
         $this->cookie = GetCookiesArr($page, $this->cookie);
         if (!preg_match('@https?://api(?:-secure)?\\.solvemedia\\.com/papi/challenge\\.(?:no)?script\\?k=([\\w\\-\\.]+)@i', $page, $smKey)) {
             if (preg_match($this->DLRegexp, $page, $DL)) {
                 return $this->RedirectDownload($DL[0], urldecode(parse_url($DL[0], PHP_URL_PATH)));
             }
             html_error('CAPTCHA not found.');
         }
         $data = $this->DefaultParamArr($this->link, $this->cookie, $start_timer['redirect_url'], true);
         $data['step'] = '1';
         $data['posturl'] = urldecode(parse_url($start_timer['redirect_url'], PHP_URL_PATH));
         return $this->SolveMedia($smKey[1], $data, $start_timer['redirect_url']);
     } else {
         $post = $this->verifySolveMedia();
         $post['send'] = 'Submit';
         $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         $page = $this->GetPage($this->baseurl . $_POST['posturl'], $this->cookie, $post);
         $this->cookie = GetCookiesArr($page, $this->cookie);
         if (preg_match("@\nLocation: (?:https?://(?:www\\.)?alfafile\\.net)?/file/{$this->fid}/?\r?\n@i", $page)) {
             $page = $this->GetPage($this->link, $this->cookie);
         }
         if (!preg_match($this->DLRegexp, $page, $DL)) {
             html_error('Download Link Not Found.');
         }
         return $this->RedirectDownload($DL[0], urldecode(parse_url($DL[0], PHP_URL_PATH)));
     }
 }
Beispiel #12
0
 private function FreeDL()
 {
     $pUrl = 'http://filesflash.com/freedownload.php';
     if (!empty($_POST['step']) && $_POST['step'] == '1') {
         if (!empty($_POST['cookie'])) {
             $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         }
         if (empty($_POST['recaptcha_response_field'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         if (empty($_POST['recaptcha_challenge_field'])) {
             html_error('Empty reCAPTCHA challenge.');
         }
         $post = array();
         $post['token'] = $_POST['token'];
         $post['recaptcha_challenge_field'] = urlencode($_POST['recaptcha_challenge_field']);
         $post['recaptcha_response_field'] = urlencode($_POST['recaptcha_response_field']);
         $post['submit'] = 'Submit';
         $page = $this->GetPage($pUrl, $this->cookie, $post);
         is_present($page, 'Your IP address is already downloading another link.');
         if (stripos($page, 'google.com/recaptcha/api/') !== false || stripos($page, 'recaptcha.net/') !== false) {
             html_error('Wrong captcha entered.');
         }
         if (!preg_match($this->DLregexp, $page, $dlink)) {
             html_error('Error: Download link not found.');
         }
         if (!preg_match('@\\scount\\s*=\\s*(\\d+)\\s*;@i', $page, $wait)) {
             html_error('Error: Countdown not found.');
         }
         if ($wait[1] > 0) {
             $this->CountDown($wait[1]);
         }
         return $this->RedirectDownload($dlink[0], urldecode(basename(parse_url($dlink[0], PHP_URL_PATH))), $this->cookie, 0, $pUrl);
     }
     $this->cookie = GetCookiesArr($this->page, $this->cookie);
     $post = array();
     $post['token'] = urlencode(cut_str($this->page, 'name="token" value="', '"')) or html_error('Download Token not Found.');
     $post['freedl'] = urlencode(cut_str($this->page, 'name="freedl" value="', '"')) or $post['submit'] = '+Start+free+download+';
     $page = $this->GetPage($pUrl, $this->cookie, $post);
     is_present($page, 'Your IP address is already downloading another link.');
     $data = $this->DefaultParamArr($this->link, $this->cookie, true, true);
     $data['step'] = 1;
     $data['token'] = $post['token'];
     // Modified regexp
     if (!preg_match('@https?://(?:[\\w\\-]+\\.)?(?:google\\.com/recaptcha/api|recaptcha\\.net)/(?:challenge|noscript)\\?(?:[^\'\\"<>&]+&(?:amp;)?)*k=([\\w\\.\\-]+)@i', $page, $reCaptcha)) {
         html_error('reCAPTCHA not found.');
     }
     $this->reCAPTCHA($reCaptcha[1], $data);
     exit;
 }
 private function FreeDL()
 {
     $url = 'http://uploaded.net';
     $errs = array('host' => 'Download of this file isn\'t available right now, try again later.', 'limit-dl' => 'Free download limit reached.', 'parallel' => 'You\'re already downloading a file.', 'size' => 'Only Premium users can download this file.', 'slot' => 'Free download of this file isn\'t available right now, try again later.', 'captcha' => 'Wrong CAPTCHA entered.');
     if (empty($_POST['step']) || $_POST['step'] != 1) {
         // Find countdown
         if (!preg_match('@<span[^>]*>[^<>]+<span[^>]*>(\\d+)</span>[\\s\\t\\r\\n]+seconds[^<>]*</span>@i', $this->page, $cD)) {
             html_error('Countdown not found.');
         }
         // Check slots
         $page = $this->GetPage("{$url}/io/ticket/slot/" . $this->fid, $this->cookie, 0, 0, 0, 1);
         if (stripos($page, 'succ:true') === false) {
             if (preg_match('@\\"?err\\"?\\s*:\\s*\\"((?:[^\\"]+(?:\\\\")?)+)(?<!\\\\)\\"@i', $page, $err) && !empty($errs[$err[1]])) {
                 html_error($errs[$err[1]]);
             } else {
                 html_error($errs['slot']);
             }
         }
         // Download js and find site's recaptcha key
         $js = $this->GetPage("{$url}/js/download.js", $this->cookie);
         if (!preg_match('@Recaptcha\\.create[\\s\\t]*\\([\\s\\t]*\\"[\\s\\t]*([\\w\\-]+)[\\s\\t]*\\"@i', $js, $cpid)) {
             html_error('reCAPTCHA Not Found.');
         }
         // Do countdown
         if ($cD[1] > 0) {
             $this->CountDown($cD[1]);
         }
         // Prepare data for Show_reCaptcha and call it
         $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
         $data['step'] = '1';
         return $this->Show_reCaptcha($cpid[1], $data);
     }
     if (empty($_POST['recaptcha_response_field'])) {
         html_error('You didn\'t enter the image verification code.');
     }
     $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
     $post = array('recaptcha_challenge_field' => $_POST['recaptcha_challenge_field'], 'recaptcha_response_field' => $_POST['recaptcha_response_field']);
     $page = $this->GetPage("{$url}/io/ticket/captcha/" . $this->fid, $this->cookie, $post, 0, 0, 1);
     if (!preg_match('@https?://(?:[a-zA-Z\\d\\-]+\\.)+uploaded\\.(?:net|to)/dl/[^\\r\\n\\s\\t\'\\"<>]+@i', $page, $dl)) {
         if (preg_match('@\\"?err\\"?\\s*:\\s*\\"((?:[^\\"]+(?:\\\\")?)+)(?<!\\\\)\\"@i', $page, $err)) {
             if (!empty($errs[$err[1]])) {
                 html_error($errs[$err[1]]);
             }
             is_present($err[1], 'free downloads for this hour', $errs['limit-dl'] . ' Wait and hour an try again.');
             html_error('Unknown error after sending captcha: ' . htmlentities($err[1]));
         }
         html_error('Download Link Not Found.');
     }
     $this->RedirectDownload($dl[0], 'uploaded_net_fr', $this->cookie);
 }
Beispiel #14
0
 private function MF_Captcha()
 {
     if (!empty($this->page) && stripos($this->page, ">Authorize Download</a>") === false) {
         return;
     }
     if (!empty($_POST['step']) && $_POST['step'] == '1') {
         $_POST['step'] = false;
         if (empty($_POST['recaptcha2_response_field']) && empty($_POST['recaptcha_response_field']) && empty($_POST['adcopy_response'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         if (empty($_POST['adcopy_response'])) {
             if (empty($_POST['recaptcha2_public_key'])) {
                 $post = array('recaptcha_challenge_field' => urlencode($_POST['recaptcha_challenge_field']), 'recaptcha_response_field' => urlencode($_POST['recaptcha_response_field']));
             } else {
                 $post = $this->verifyReCaptchav2();
             }
         } else {
             $post = $this->verifySolveMedia();
         }
         $this->cookie = StrToCookies(urldecode($_POST['cookie']));
         $purl = 'http://www.mediafire.com/?' . $this->fid[3];
         $this->page = $this->GetPage($purl, $this->cookie, $post);
         $this->cookie = GetCookiesArr($this->page, $this->cookie);
         is_present($this->page, 'Your entry was incorrect, please try again!');
         $this->page = $this->GetPage($this->link, $this->cookie, 0, $purl);
         $this->cookie = GetCookiesArr($this->page, $this->cookie);
         is_present($this->page, 'Your entry was incorrect, please try again!.');
         $this->MF_Captcha();
     } else {
         $data = $this->DefaultParamArr($this->link, $this->cookie);
         $data['step'] = 1;
         if (($pos = stripos($this->page, 'data-sitekey=')) !== false && preg_match('@data-sitekey=\\s*[\\"\']([\\w\\.\\-]+)[\\"\']@i', $this->page, $cKey, 0, $pos)) {
             // reCAPTCHA v2
             return $this->reCAPTCHAv2($cKey[1], $data);
         } else {
             if (($pos = stripos($this->page, '://api.solvemedia.com/')) !== false && preg_match('@https?://api\\.solvemedia\\.com/papi/challenge\\.(?:no)?script\\?k=([\\w\\.\\-]+)@i', $this->page, $cKey, 0, $pos)) {
                 // SolveMedia
                 return $this->SolveMedia($cKey[1], $data);
             } else {
                 if (preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w\\.\\-]+)@i', $this->page, $cKey)) {
                     // Old reCAPTCHA
                     return $this->reCAPTCHA($cKey[1], $data);
                 }
             }
         }
         html_error('Error: CAPTCHA not found.');
     }
 }
Beispiel #15
0
 public function Download($link)
 {
     $this->cookie = !empty($_POST['step']) && !empty($_POST['cookie']) ? StrToCookies(decrypt(urldecode($_POST['cookie']))) : array('ff' => 'off');
     if (!preg_match('@/video/(x[0-9a-zA-Z]+)@i', $link, $xid)) {
         html_error('Video ID not found.');
     }
     $this->xid = $xid[1];
     $this->link = 'http://www.dailymotion.com/video/' . $this->xid;
     if (empty($_POST['step'])) {
         $page = $this->GetPage($this->link, $this->cookie);
         $this->cookie = GetCookiesArr($page, $this->cookie);
         $status = (int) substr($page, 9, 3);
         switch ($status) {
             case 200:
                 break;
             case 403:
                 html_error('This video is forbidden to download!');
                 break;
             case 404:
                 html_error('404 Not Found');
                 break;
             case 410:
                 html_error('This video has been removed by the user.');
                 break;
             default:
                 html_error("Unexpected response: {$status}");
                 break;
         }
     }
     $this->getVideoInfo();
     if (empty($_POST['dlstream']) && !isset($_GET['audl'])) {
         return $this->QSelector();
     } elseif (empty($_POST['dlstream']) || !empty($this->streams[$_POST['dlstream']])) {
         $key = empty($_POST['dlstream']) ? key($this->streams) : $_POST['dlstream'];
         $DL = $this->streams[$key];
     } else {
         html_error('Selected video stream was not found.');
     }
     $filename = preg_replace('@[^ A-Za-z_\\-\\d\\.,\\(\\)\\[\\]\\{\\}&\\!\'\\@\\%\\#]@u', '_', trim($this->title), ENT_QUOTES);
     $filename .= " [DM-{$key}p][{$this->xid}].mp4";
     $page = $this->GetPage($DL, $this->cookie);
     if (!preg_match('@https?://[^/\\s]+/video/[^\\s<>\'\\"]+@i', $page, $DL)) {
         html_error('Download Link not Found.');
     }
     $this->RedirectDownload($DL[0], $filename, $this->cookie, 0, 0, $filename);
 }
Beispiel #16
0
 private function Free()
 {
     if ($_REQUEST['step'] == '1') {
         $post = array();
         $post['vvcid'] = $_POST['vvcid'];
         $post['verifycode'] = $_POST['captcha'];
         $post['FREE'] = $_POST['FREE'];
         $this->link = urldecode($_POST['link']);
         $this->cookie = StrToCookies(urldecode($_POST['cookie']));
         $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
     } else {
         $data = $this->DefaultParamArr($this->link, $this->cookie);
         $data['step'] = '1';
         $data['vvcid'] = cut_str($this->page, '<input type="hidden" name="vvcid" value="', '"');
         $data['FREE'] = cut_str($this->page, '<input type="submit" name="FREE" value="', '"');
         //Download Captcha Image
         if (!preg_match('/\\/includes\\/vvc\\.php\\?vvcid=[^"]+/', $this->page, $imgurl)) {
             html_error('Error[Captcha Link not found!]');
         }
         $cap = $this->GetPage('http://depfile.com' . $imgurl[0], $this->cookie);
         $capt_img = substr($cap, strpos($cap, "\r\n\r\n") + 4);
         $imgfile = DOWNLOAD_DIR . "depfile_captcha.jpg";
         if (file_exists($imgfile)) {
             unlink($imgfile);
         }
         if (empty($capt_img) || !write_file($imgfile, $capt_img)) {
             html_error("Error getting CAPTCHA image.", 0);
         }
         $this->EnterCaptcha($imgfile, $data, 20);
         exit;
     }
     is_present($page, cut_str($page, '<p class=\'notice\'>', '</p>'));
     if (!preg_match('/var sec=(\\d+);/', $page, $w)) {
         html_error('Error[Timer not found!]');
     }
     $this->CountDown($w[1]);
     $dlink = urldecode(cut_str($page, "document.getElementById(\"wait_input\").value= unescape('", "'"));
     if (empty($dlink)) {
         html_error('Error[Download Link - FREE not found!]');
     }
     $filename = basename(parse_url($dlink, PHP_URL_PATH));
     $this->RedirectDownload($dlink, $filename, $this->cookie, 0, $this->link);
     exit;
 }
 public function Download($link)
 {
     $Cookies = array();
     if (!empty($_POST['mfpassword'])) {
         $Cookies = StrToCookies(urldecode($_POST['cookie']));
         $page = $this->GetPage($link, $Cookies, array('downloadp' => urlencode($_POST['mfpassword'])), $link);
     }
     $link = preg_replace('@https?://([^/]+\\.)?mediafire\\.com/(?!download/)((download\\.php)|(file/)|(view/))?\\??@i', 'http://www.mediafire.com/download/', $link);
     $page = $this->GetPage($link, $Cookies);
     $Cookies = GetCookiesArr($page, $Cookies);
     if (preg_match('@\\nLocation: .*(/download/([^/\\r\\n]+)/?[^\\r\\n]*)@i', $page, $redir)) {
         $link = 'http://www.mediafire.com' . $redir[1];
         $page = $this->GetPage($link, $Cookies);
         $Cookies = GetCookiesArr($page, $Cookies);
     }
     if (preg_match('@/error\\.php\\?errno=\\d+@i', $page, $redir)) {
         $page = $this->GetPage('http://www.mediafire.com' . $redir[0]);
         if (preg_match('@error_msg_title">\\s*([^\\r\\n<>]+)\\s*<@i', $page, $err)) {
             html_error($err[1]);
         }
         html_error('Link is not available');
     }
     $this->MF_Captcha($link, $page);
     if (strpos($page, 'name="downloadp" id="downloadp"')) {
         $DefaultParam = $this->DefaultParamArr(preg_replace('@/download/([^/]+)/?.*@i', '/?$1', $link), $Cookies);
         $html = '<form action="index.php" method="POST">';
         foreach ($DefaultParam as $key => $value) {
             $html .= '<input type="hidden" name="' . $key . '" value="' . $value . '"/>';
         }
         $html .= 'Enter your password here </br><input type="text" name="mfpassword" value="" placeholder="Enter your password here" autofocus="autofocus" required="required" /><input type="submit" name="action" value="Submit"/></form>';
         echo $html;
         exit;
     }
     if (preg_match('@Location: (http:\\/\\/[^\\r\\n]+)@i', $page, $dl) || preg_match('@\\w+\\s*=\\s*\\"(https?://[^\\"]+)\\"\\s*;@i', $page, $dl)) {
         $dlink = trim($dl[1]);
         $this->RedirectDownload($dlink, "Mediafire.com", $Cookies);
     } else {
         html_error("Error: Download link [FREE] not found!");
     }
 }
Beispiel #18
0
 private function FreeDL()
 {
     if (empty($_POST['step']) || $_POST['step'] != '1') {
         if (preg_match('@Next free download from your ip will be available in <b>\\d+ \\w+@i', $this->page, $err)) {
             html_error($err[0] . '</b>');
         }
         if (!preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w\\.\\-]+)@i', $this->page, $pid)) {
             html_error('reCAPTCHA not found.');
         }
         $this->cookie = GetCookiesArr($this->page, $this->cookie);
         $data = $this->DefaultParamArr($this->link, empty($this->cookie) ? 0 : encrypt(CookiesToStr($this->cookie)));
         $data['step'] = '1';
         $this->reCAPTCHA($pid[1], $data);
         exit;
     } else {
         if (empty($_POST['recaptcha_response_field'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         if (!empty($_POST['cookie'])) {
             $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         }
         $query = array();
         $query['type'] = 'recaptcha';
         $query['challenge'] = urlencode($_POST['recaptcha_challenge_field']);
         $query['capture'] = urlencode($_POST['recaptcha_response_field']);
         $page = $this->GetPage($this->link . '?' . http_build_query($query), $this->cookie);
         $reply = $this->Get_Reply($page);
         if (!empty($reply['err'])) {
             html_error('Error: ' . htmlentities($reply['err']));
         }
         if (empty($reply['href']) || !preg_match('@https?://[\\w\\-]+\\.cloudstoreservice\\.net/[^\'\\"\\t<>\\r\\n]+@i', $reply['href'], $dlink)) {
             if (!empty($reply['href']) && stripos($reply['href'], '/dl/') === 0) {
                 html_error('Expired/Used/Invalid DL Session.');
             }
             html_error('Error: Download link not found.');
         }
         $this->RedirectDownload($dlink[0], urldecode(basename(parse_url($dlink[0], PHP_URL_PATH))));
     }
 }
 private function FreeDL()
 {
     $purl = 'http://' . $this->domain . '/';
     if (!empty($_POST['step']) && $_POST['step'] == 1) {
         if (empty($_POST['recaptcha_response_field'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         if (empty($_POST['fid'])) {
             html_error('FileID not found after POST.');
         }
         $query = array('fid' => $_POST['fid'], 'challenge' => $_POST['recaptcha_challenge_field'], 'response' => $_POST['recaptcha_response_field']);
         $page = $this->GetPage($purl . 'get_file.php?' . http_build_query($query), $this->cookie);
         is_present($page, 'load_recaptcha()', 'Error: Wrong CAPTCHA entered.');
         if (!preg_match($this->DLregexp, $page, $dlink)) {
             html_error('Download link Not Found.');
         }
         $this->RedirectDownload($dlink[0], basename(urldecode(parse_url($dlink[0], PHP_URL_PATH))));
     } else {
         $page = $this->GetPage($this->link, $this->cookie, array('gateway_result' => '1'));
         is_present($page, 'This file does not exist', 'The requested file is not found');
         $this->cookie = GetCookiesArr($this->page, $this->cookie);
         if ($this->TryFreeDLTricks) {
             $this->Mesg = lang(300);
         }
         if (stripos($page, 'Connection limit has been exhausted for your IP address!') !== false) {
             if (preg_match('@<span class="html_download_api-limit_interval">[\\s\\t\\r\\n]*(\\d+)[\\s\\t\\r\\n]*</span>@i', $page, $limit)) {
                 $x = 0;
                 if ($this->TryFreeDLTricks && $limit[1] > 45) {
                     while ($x < 3) {
                         $page = $this->GetPage($purl . 'get_file.php?fd=clearlimit', $this->cookie);
                         if (($fd2 = cut_str($page, 'name="fd2" value="', '"')) == false) {
                             break;
                         }
                         insert_timer(30, 'Trying to reduce ip-limit waiting time.');
                         $page = $this->GetPage($purl . 'get_file.php?fd2=' . urlencode($fd2), $this->cookie);
                         $page = $this->GetPage($this->link, $this->cookie, array('gateway_result' => '1'));
                         if (!preg_match('@<span class="html_download_api-limit_interval">[\\s\\t\\r\\n]*(\\d+)[\\s\\t\\r\\n]*</span>@i', $page, $_limit)) {
                             $this->Mesg .= '<br /><br />Skipped the remaining ' . ($limit[1] - 30) . ' secs of ip-limit wait time.';
                             $this->changeMesg($this->Mesg);
                             $limit[1] = 0;
                             break;
                         }
                         $diff = $limit[1] - 30 - $_limit[1];
                         $limit[1] = $_limit[1];
                         $this->Mesg .= "<br /><br />Skipped {$diff} secs of ip-limit wait time.";
                         $this->changeMesg($this->Mesg);
                         if ($diff < 1) {
                             break;
                         }
                         // Error?
                         $x++;
                     }
                 }
                 if ($limit[1] > 0) {
                     return $this->JSCountdown($limit[1], $this->DefaultParamArr($this->link), 'Connection limit has been exhausted for your IP address');
                 }
             } else {
                 html_error('Connection limit has been exhausted for your IP address. Please try again later.');
             }
         }
         if (!preg_match('@var[\\s\\t]+fid[\\s\\t]*=[\\s\\t]*\'(\\w+)\'@i', $page, $fid)) {
             html_error('FileID not found.');
         }
         if (!preg_match('@Recaptcha\\.create[\\s\\t]*\\([\\s\\t]*[\'\\"]([\\w\\-]+)[\'\\"]@i', $page, $cpid)) {
             html_error('reCAPTCHA Not Found.');
         }
         if (!preg_match('@setTimeout\\(\'load_form\\(fid, msg\\)\',[\\s\\t]*(\\d+)([\\s\\t]*\\*[\\s\\t]*1000)?[\\s\\t]*\\);@i', $page, $cd)) {
             html_error('Countdown not found.');
         }
         $cd = empty($cd[2]) ? $cd[1] / 1000 : $cd[1];
         if ($cd > 0) {
             $this->CountDown($cd);
         }
         if ($this->TryFreeDLTricks) {
             $page = $this->GetPage($purl . 'get_file.php?fd2=' . urlencode($fid[1]), $this->cookie);
             if (preg_match($this->DLregexp, $page, $dlink)) {
                 return $this->RedirectDownload($dlink[0], basename(urldecode(parse_url($dlink[0], PHP_URL_PATH))));
             }
             $this->Mesg .= '<br /><br /><b>Cannot skip captcha.</b>';
             $this->changeMesg($this->Mesg);
         }
         $page = $this->GetPage($purl . 'get_file.php?fid=' . urlencode($fid[1]), $this->cookie);
         is_notpresent($page, 'load_recaptcha()', 'Error: Countdown skipped?.');
         $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
         $data['step'] = '1';
         $data['fid'] = urlencode($fid[1]);
         $this->Show_reCaptcha($cpid[1], $data);
     }
 }
Beispiel #20
0
 public function Download($link)
 {
     $this->cookie = isset($_POST['yt_QS']) && !empty($_POST['cookie']) ? StrToCookies(decrypt(urldecode($_POST['cookie']))) : array();
     $url = parse_url($link);
     $this->vid = array();
     if (host_matches('youtu.be', $url['host'])) {
         preg_match('@/([\\w\\-\\.]{11})@i', $url['path'], $this->vid);
     } elseif (empty($url['query']) || ($this->vid[1] = cut_str('&' . $url['query'] . '&', '&v=', '&')) === false || !preg_match('@^[\\w\\-\\.]{11}$@i', $this->vid[1])) {
         preg_match('@/(?:v|(?:embed))/([\\w\\-\\.]{11})@i', $url['path'], $this->vid);
     }
     if (empty($this->vid[1])) {
         html_error('Video ID not found.');
     }
     $this->vid = $this->vid[1];
     $link = 'http://www.youtube.com/watch?v=' . $this->vid;
     $this->page = $this->GetPage('http://www.youtube.com/get_video_info?video_id=' . $this->vid . '&asv=3&el=detailpage&hl=en_US', $this->cookie);
     $response = array_map('urldecode', $this->FormToArr(substr($this->page, strpos($this->page, "\r\n\r\n") + 4)));
     if (!empty($response['reason'])) {
         html_error('[' . htmlentities($response['errorcode']) . '] ' . htmlentities($response['reason']));
     }
     if (isset($_REQUEST['step']) || preg_match('@Location: https?://(www\\.)?youtube\\.com/das_captcha@i', $this->page)) {
         $this->captcha($link);
     }
     if (empty($response['url_encoded_fmt_stream_map'])) {
         html_error('Video links not found.');
     }
     $fmt_url_maps = explode(',', $response['url_encoded_fmt_stream_map']);
     $this->fmts = array(38, 37, 22, 45, 35, 44, 34, 43, 18, 5, 17);
     $yt_fmt = empty($_REQUEST['yt_fmt']) ? '' : $_REQUEST['yt_fmt'];
     $this->fmturlmaps = $this->GetVideosArr($fmt_url_maps);
     if (empty($yt_fmt) && !isset($_GET['audl'])) {
         return $this->QSelector($link);
     } elseif (isset($_REQUEST['ytube_mp4']) && $_REQUEST['ytube_mp4'] == 'on' && !empty($yt_fmt)) {
         //look for and download the highest quality we can find?
         if ($yt_fmt == 'highest') {
             foreach ($this->fmts as $fmt) {
                 if (array_key_exists($fmt, $this->fmturlmaps)) {
                     $furl = $this->fmturlmaps[$fmt];
                     break;
                 }
             }
         } elseif (!($furl = $this->fmturlmaps[$yt_fmt])) {
             html_error('Specified video format not found');
         } else {
             $fmt = $yt_fmt;
         }
     } else {
         //just get the one Youtube plays by default (in some cases it could also be the highest quality format)
         $fmt = key($this->fmturlmaps);
         $furl = $this->fmturlmaps[$fmt];
     }
     $ext = '.flv';
     $fmtexts = array('.3gp' => array(17), '.mp4' => array(18, 22, 37, 38), '.webm' => array(43, 44, 45));
     foreach ($fmtexts as $k => $v) {
         if (!is_array($v)) {
             $v = array($v);
         }
         if (in_array($fmt, $v)) {
             $ext = $k;
             break;
         }
     }
     if (empty($response['title'])) {
         html_error('No video title found! Download halted.');
     }
     $FileName = str_replace(str_split('\\/:*?"<>|'), '_', html_entity_decode(trim($response['title']), ENT_QUOTES)) . "-[YT-f{$fmt}][{$this->vid}]{$ext}";
     if (isset($_REQUEST['ytdirect']) && $_REQUEST['ytdirect'] == 'on') {
         echo "<br /><br /><h4><a style='color:yellow' href='" . urldecode($furl) . "'>Click here or copy the link to your download manager to download</a></h4> (This may not work)";
         echo "<input name='dlurl' style='width: 1000px; border: 1px solid #55AAFF; background-color: #FFFFFF; padding:3px' value='" . urldecode($furl) . "' onclick='javascript:this.select();' readonly></input>";
     } else {
         $this->RedirectDownload($furl, $FileName, $this->cookie, 0, 0, $FileName);
     }
 }
Beispiel #21
0
 private function Login($captcha = false)
 {
     global $premium_acc;
     if ($_REQUEST["upl_acc"] == "on" && (!empty($_GET["upl_cookie"]) || !empty($_GET["upl_hash"]))) {
         $usecookie = empty($_GET["upl_cookie"]) ? strrev(dcd(!empty($_GET["upl_hash"]))) : $_GET['upl_cookie'];
     } elseif (isset($_REQUEST["cookieuse"]) && $_REQUEST["cookieuse"] == "on" && preg_match("/remembered_user\\s*=\\s*([\\w|\\%]+)\\s*;?/i", $_REQUEST["cookie"], $c) || $_REQUEST["premium_acc"] == "on" && !empty($premium_acc["uploading_com"]["cookie"])) {
         $usecookie = empty($c[1]) ? !empty($premium_acc["uploading_com"]["cookie"]) : $c[1];
     } else {
         $usecookie = false;
     }
     $posturl = 'http://uploading.com/';
     if (!$usecookie) {
         $pA = !empty($_REQUEST["premium_user"]) && !empty($_REQUEST["premium_pass"]) ? true : false;
         $email = $pA ? trim($_REQUEST["premium_user"]) : $premium_acc["uploading_com"]["user"];
         $password = $pA ? trim($_REQUEST["premium_pass"]) : $premium_acc["uploading_com"]["pass"];
         $post = array();
         if ($captcha == true) {
             if (empty($_POST['recaptcha_response_field'])) {
                 html_error("You didn't enter the image verification code.");
             }
             $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
             $post['recaptcha_response_field'] = $_POST['recaptcha_response_field'];
             $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
             if (!empty($_POST['cuser']) && !empty($_POST['cpass'])) {
                 $email = decrypt(urldecode($_POST['cuser']));
                 $password = decrypt(urldecode($_POST['cpass']));
             }
         }
         // This check is important incase there's conflict in post account data, do look in the bracket at error message...
         if (empty($email) || empty($password)) {
             html_error('Login failed, email or password is empty!');
         }
         $post['email'] = urlencode($email);
         $post['password'] = urlencode($password);
         $post['remember'] = 'on';
         $page = $this->GetPage($posturl . 'general/login_form/?ajax', $this->cookie, $post, $posturl . "\r\nX-Requested-With: XMLHttpRequest");
         $json = $this->Get_Reply($page);
         if (!empty($json['error'])) {
             html_error('Login Error: ' . $json['error']);
         }
         if (!empty($json['answer']['captcha'])) {
             if (!preg_match('@\\(\'recaptcha_block\', \'([^\']+)\'\\);@', $this->page, $c)) {
                 html_error('Error: Login captcha data not found.');
             }
             $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
             $data['step'] = 'captcha';
             if ($pA) {
                 $data['cuser'] = urlencode(encrypt($email));
                 $data['cpass'] = urlencode(encrypt($password));
             }
             $this->Show_reCaptcha($c[1], $data);
             exit;
         }
         if (!empty($json['redirect'])) {
             $this->cookie = GetCookiesArr($page, $this->cookie);
         } else {
             html_error("Error [Login Page Response UNKNOWN!]");
         }
     } else {
         $this->cookie['remembered_user'] = $usecookie;
         $this->cookie['u'] = 1;
         $this->cookie['autologin'] = 1;
     }
     $page = $this->GetPage($posturl, $this->cookie, 0, $posturl);
     is_present($page, 'class="i_premium"', 'Error: Account isn\'t premium?');
     $this->cookie = GetCookiesArr($page, $this->cookie);
     return $this->Premium();
 }
 private function Free()
 {
     global $PHP_SELF;
     switch ($_REQUEST['step']) {
         case 'captcha':
             $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
             $post['recaptcha_response_field'] = $_POST['recaptcha_response_field'];
             $post['section'] = $_POST['section'];
             $post['did'] = $_POST['did'];
             $post['submit'] = $_POST['submit'];
             $this->link = urldecode($_POST['link']);
             $this->cookie = urldecode($_POST['cookie']);
             $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
             break;
         case 'countdown':
             $this->link = urldecode($_POST['link']);
             $this->cookie = StrToCookies(urldecode($_POST['cookie']));
             $page = $this->GetPage($this->link, $this->cookie, 0, $this->link);
             $this->cookie = GetCookiesArr($page, $this->cookie);
             $post = array();
             $post['section'] = $_POST['section'];
             $post['did'] = $_POST['did'];
             $post['submit'] = 'Free Download';
             $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
             break;
         default:
             if (!preg_match('@var time = (\\d+)\\.?[0-9]?@', $this->page, $w)) {
                 html_error("Error [Timer not found!]");
             }
             $wait = trim($w[1]);
             $form = cut_str($this->page, '<td width="138" height="10"', '</form>');
             if (!preg_match('@<form action="([^"]+)"@', $form, $fl)) {
                 html_error('Error [Post Link - FREE not found!]');
             }
             $this->link = trim($fl[1]);
             if (!preg_match_all('@<input type="hidden" value="([^"]+)" name="([^"]+)" \\/>@', $form, $ck)) {
                 html_error("Error [Post Data 1 FREE not found!]");
             }
             $match = array_combine($ck[2], $ck[1]);
             if ($wait > 70) {
                 $data = array_merge($this->DefaultParamArr($this->link, $this->cookie), $match);
                 $data['step'] = 'countdown';
                 $this->JSCountDown($wait, $data);
             } else {
                 $this->CountDown($wait);
                 $post = array();
                 foreach ($match as $key => $value) {
                     $post[$key] = $value;
                 }
                 $post['submit'] = 'Free Download';
                 $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
             }
             break;
     }
     if (preg_match('@\\/challenge\\?k=([^"]+)"@', $page, $cap) && preg_match('@\\/noscript\\?k=([^"]+)"@', $page, $cap) || strpos($page, 'Wrong Captcha!')) {
         if (!preg_match_all('@<input type="hidden" value="([^"]+)" name="([^"]+)" \\/>@', $page, $ck)) {
             html_error("Error [Post Data 2 FREE not found!]");
         }
         $data = array_merge($this->DefaultParamArr($this->link, $this->cookie), array_combine($ck[2], $ck[1]));
         echo "<script language='JavaScript'>var RecaptchaOptions={theme:'white', lang:'en'};</script>\n";
         echo "\n<center><form name='dl' action='{$PHP_SELF}' method='post' ><br />\n";
         foreach ($data as $name => $input) {
             echo "<input type='hidden' name='{$name}' id='{$name}' value='{$input}' />\n";
         }
         echo "<script type='text/javascript' src='http://www.google.com/recaptcha/api/challenge?k={$cap['1']}'></script>";
         echo "<noscript><iframe src='http://www.google.com/recaptcha/api/noscript?k={$cap['1']}' height='300' width='500' frameborder='0'></iframe><br />";
         echo "<textarea name='recaptcha_challenge_field' rows='3' cols='40'></textarea><input type='hidden' name='recaptcha_response_field' value='manual_challenge' /></noscript><br />";
         echo "<input type='submit' name='submit' onclick='javascript:return checkc();' value='Download' />\n";
         echo "<script type='text/javascript'>/*<![CDATA[*/\nfunction checkc(){\nvar capt=document.getElementById('recaptcha_response_field');\nif (capt.value == '') { window.alert('You didn\\'t enter the image verification code.'); return false; }\nelse { return true; }\n}\n/*]]>*/</script>\n";
         echo "</form></center>\n</body>\n</html>";
         exit;
     }
     if (!preg_match('@Location: (http:\\/\\/[^\\r\\n]+)@i', $page, $dl)) {
         html_error('Error [Download Link FREE not found!]');
     }
     $dlink = trim($dl[1]);
     $filename = basename(parse_url($dlink, PHP_URL_PATH));
     $this->RedirectDownload($dlink, $filename, $this->cookie, 0, $this->link);
     exit;
 }
 if (!empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) {
     // Decrypt login if it was encrypted
     if (!empty($_REQUEST['A_encrypted'])) {
         $_REQUEST['up_login'] = decrypt(urldecode($_REQUEST['up_login']));
         $_REQUEST['up_pass'] = decrypt(urldecode($_REQUEST['up_pass']));
         unset($_REQUEST['A_encrypted']);
     }
     $post = array();
     $post['LoginForm%5Bemail%5D'] = urlencode($_REQUEST['up_login']);
     $post['LoginForm%5Bpassword%5D'] = urlencode($_REQUEST['up_pass']);
     $post['LoginForm%5BrememberMe%5D'] = 1;
     if (!empty($_POST['step']) && $_POST['step'] == '1') {
         if (empty($_POST['captcha'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         $cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         $post['LoginForm%5BverifyCode%5D'] = urlencode($_POST['captcha']);
     }
     //Redirects
     $rdc = 0;
     $page = false;
     // False value for starting the loop.
     $redir = "http://{$domain}/auth/login";
     if (!empty($_POST['referer'])) {
         $referer = $_POST['referer'];
     }
     while (($redir = ChkRGRedirs($page, $redir, '/auth/login', $default_acc)) && $rdc < 15) {
         $page = cURL($redir, $cookie, $post, $referer);
         $cookie = GetCookiesArr($page, $cookie);
         $referer = $redir;
         $rdc++;
Beispiel #24
0
 protected function postCaptcha(&$step)
 {
     if (empty($_POST['step']) || empty($_POST['captcha_type'])) {
         return false;
     }
     if (!empty($_POST['cookie'])) {
         $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         $this->cookie['lang'] = 'english';
         $_POST['cookie'] = false;
     }
     $post = !empty($_POST['T8gXFS']) && is_array($_POST['T8gXFS']) ? $_POST['T8gXFS'] : array();
     switch ($_POST['captcha_type']) {
         default:
             return html_error('Invalid captcha type.');
         case '1':
             // Image (gd) Captcha
             $this->captcha = 1;
             if (empty($_POST['captcha'])) {
                 html_error('[1] You didn\'t enter the image verification code.');
             }
             $post['code'] = urlencode($_POST['captcha']);
             break;
         case '2':
             // Decoded Text Captcha
             $this->captcha = 2;
             if (empty($_POST['captcha'])) {
                 html_error('[2] You didn\'t enter the image verification code.');
             }
             $post['code'] = urlencode($_POST['captcha']);
             break;
         case '3':
             // Old reCAPTCHA
             $this->captcha = 3;
             if (empty($_POST['recaptcha_response_field'])) {
                 html_error('[3] You didn\'t enter the image verification code.');
             }
             if (empty($_POST['recaptcha_challenge_field'])) {
                 html_error('[3] Empty reCAPTCHA challenge.');
             }
             $post['recaptcha_challenge_field'] = urlencode($_POST['recaptcha_challenge_field']);
             $post['recaptcha_response_field'] = urlencode($_POST['recaptcha_response_field']);
             break;
         case '4':
             // Solvemedia
             $this->captcha = 4;
             $post = array_merge($post, $this->verifySolveMedia());
             break;
     }
     $step = (int) $_POST['step'];
     $_POST['step'] = $_POST['captcha_type'] = false;
     $this->page = $this->GetPage($this->link, $this->cookie, $post);
     $this->cookie = GetCookiesArr($this->page, $this->cookie);
     return false;
 }
Beispiel #25
0
 private function Login()
 {
     if (!empty($_REQUEST['pA_encrypted']) && !empty($_REQUEST['premium_user']) && !empty($_REQUEST['premium_pass'])) {
         $_REQUEST['premium_user'] = decrypt(urldecode($_REQUEST['premium_user']));
         $_REQUEST['premium_pass'] = decrypt(urldecode($_REQUEST['premium_pass']));
         unset($_REQUEST['pA_encrypted']);
     }
     $pA = empty($_REQUEST['premium_user']) || empty($_REQUEST['premium_pass']) ? false : true;
     $user = $pA ? $_REQUEST['premium_user'] : $GLOBALS['premium_acc']['rapidgator_net']['user'];
     $pass = $pA ? $_REQUEST['premium_pass'] : $GLOBALS['premium_acc']['rapidgator_net']['pass'];
     if (empty($user) || empty($pass)) {
         html_error('Login Failed: User or Password is empty. Please check login data.', 0);
     }
     $this->cookie = array('lang' => 'en');
     // Account is always showed as free if it comes from a file, as i don't send file's link as referer, lets reset the cookies.
     $post = array();
     $post['LoginForm%5Bemail%5D'] = urlencode($user);
     $post['LoginForm%5Bpassword%5D'] = urlencode($pass);
     $post['LoginForm%5BrememberMe%5D'] = '1';
     if (!empty($_POST['step']) && $_POST['step'] == '1') {
         if (empty($_POST['captcha'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         $post['LoginForm%5BverifyCode%5D'] = urlencode($_POST['captcha']);
     }
     $purl = 'http://rapidgator.net/';
     // There are more of those redirects at login
     $rdc = 0;
     $page = false;
     // False value for starting the loop.
     $redir = $purl . 'auth/login';
     $this->referer = !empty($GLOBALS['Referer']) && $GLOBALS['Referer'] != $this->link ? $GLOBALS['Referer'] : $purl;
     while (($redir = $this->ChkRGRedirs($page, $redir, '(?:/auth/login|/site/ChangeLocation/key/)')) && $rdc < 15) {
         $page = cURL($redir, $this->cookie, $post, $this->referer);
         $this->cookie = GetCookiesArr($page, $this->cookie);
         $this->referer = $redir;
         $rdc++;
     }
     is_present($page, 'Error e-mail or password.', 'Login Failed: Email/Password incorrect.');
     is_present($page, 'E-mail is not a valid email address.', 'Login Failed: Login isn\'t an email address.');
     is_present($page, 'We discovered that you try to access your account from unusual location.', 'Login Failed: Login Blocked By IP, Check Account Email And Follow The Steps To Add IP to Whitelist.');
     if (stripos($page, 'The code from a picture does not coincide') !== false) {
         if (!empty($_POST['step']) && $_POST['step'] == '1') {
             html_error('Login Failed: Incorrect CAPTCHA response.');
         }
         if (!preg_match('@(https?://(?:[^\\./\\r\\n\'\\"\\t\\:]+\\.)?rapidgator\\.net(?:\\:\\d+)?)?/auth/captcha/\\w+/\\w+@i', $page, $imgurl)) {
             html_error('Error: CAPTCHA not found.');
         }
         $imgurl = empty($imgurl[1]) ? 'http://rapidgator.net' . $imgurl[0] : $imgurl[0];
         //Download captcha img.
         $capt_page = cURL($imgurl, $this->cookie);
         $capt_img = substr($capt_page, strpos($capt_page, "\r\n\r\n") + 4);
         $imgfile = DOWNLOAD_DIR . 'rapidgator_captcha.png';
         if (file_exists($imgfile)) {
             unlink($imgfile);
         }
         if (!write_file($imgfile, $capt_img)) {
             html_error('Error getting CAPTCHA image.');
         }
         unset($capt_page, $capt_img);
         $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
         $data['step'] = '1';
         $data['premium_acc'] = 'on';
         // I should add 'premium_acc' to DefaultParamArr()
         if ($pA) {
             $data['pA_encrypted'] = 'true';
             $data['premium_user'] = urlencode(encrypt($user));
             // encrypt() will keep this safe.
             $data['premium_pass'] = urlencode(encrypt($pass));
             // And this too.
         }
         $this->EnterCaptcha($imgfile . '?' . time(), $data);
         exit;
     }
     //is_present($page, 'The code from a picture does not coincide', 'Login Failed: Captcha... (T8: I will add it later)');
     if (empty($this->cookie['user__'])) {
         html_error("Login Error: Cannot find 'user__' cookie.");
     }
     $this->cookie['lang'] = 'en';
     $page = cURL($purl, $this->cookie, 0, $purl . 'auth/login');
     is_present($page, '>Free</a>', 'Account isn\'t premium');
     $this->PremiumDL();
 }
Beispiel #26
0
 private function Free()
 {
     if ($_REQUEST['step'] == '1') {
         $this->link = urldecode($_POST['link']);
         $this->cookie = StrToCookies(urldecode($_POST['cookie']));
         $post = array();
         foreach ($_POST['tmp'] as $k => $v) {
             $post[$k] = $v;
         }
         $post['code'] = $_POST['captcha'];
         $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
     } else {
         $form = cut_str($this->page, '<Form method="POST" action=\'\'>', '</Form>');
         if (!preg_match_all('/<input type="(hidden|submit)" name="([^"]+)" value="([^"]+)?">/', $form, $match)) {
             html_error('Error[Post Form 1 - FREE not found!]');
         }
         $match = array_combine($match[2], $match[3]);
         $post = array();
         foreach ($match as $k => $v) {
             $post[$k] = $v;
         }
         $page = $this->GetPage($this->link, $this->cookie, $post, $this->link);
     }
     if (stristr($page, 'Enter code below')) {
         $form = cut_str($page, '<Form name="F1" method="POST"', '</Form>');
         if (stristr($form, cut_str($form, '<div class="err">', '</div>'))) {
             echo "<center><font color='red'><b>Wrong Captcha, Please Retry!</b></font></center>";
         }
         if (!preg_match_all('/<input type="hidden" name="([^"]+)" value="([^"]+)?">/', $form, $match)) {
             html_error('Error[Post Form 2 - FREE not found!]');
         }
         $match = array_combine($match[1], $match[2]);
         if (!preg_match('/(\\d+)<\\/span> seconds/', $form, $w)) {
             html_error('Error[Timer not found!]');
         }
         $this->CountDown($w[1]);
         $data = $this->DefaultParamArr($this->link, $this->cookie);
         $data['step'] = '1';
         foreach ($match as $k => $v) {
             $data["tmp[{$k}]"] = $v;
         }
         // Download captcha image
         if (!preg_match('/http:\\/\\/www\\.upgrand\\.com\\/captchas\\/[^\'"]+/', $form, $img)) {
             html_error('Error[Captcha Image not found!]');
         }
         $page = $this->GetPage($img[0], $this->cookie);
         $capt_img = substr($page, strpos($page, "\r\n\r\n") + 4);
         $imgfile = DOWNLOAD_DIR . 'upgrand_captcha.jpg';
         if (file_exists($imgfile)) {
             unlink($imgfile);
         }
         if (!write_file($imgfile, $capt_img)) {
             html_error('Error getting CAPTCHA image.');
         }
         $this->EnterCaptcha($imgfile . '?' . time(), $data, 20);
         exit;
     }
     is_present($page, cut_str($page, '<div class="err">', '<br>'));
     if (!preg_match('/https?:\\/\\/sv\\d+\\.upgrand\\.com(:\\d+)?\\/d\\/[^\\r\\n\'"]+/', $page, $dl)) {
         html_error('Error[Download Link - FREE not found!]');
     }
     $dlink = trim($dl[0]);
     $filename = basename(parse_url($dlink, PHP_URL_PATH));
     $this->RedirectDownload($dlink, $filename, $this->cookie, 0, $this->link);
     exit;
 }
Beispiel #27
0
 private function Login($user, $pass)
 {
     $purl = 'http://' . $this->domain . '/';
     $post = array();
     $post['LoginForm%5Busername%5D'] = urlencode($user);
     $post['LoginForm%5Bpassword%5D'] = urlencode($pass);
     $post['LoginForm%5BrememberMe%5D'] = 1;
     $post['yt0'] = 'Submit';
     if (empty($_POST['step']) || !in_array($_POST['step'], array('1', '2'))) {
         $page = $this->GetPage($purl . 'login.html', $this->cookie, $post, $purl);
         $this->cookie = GetCookiesArr($page, $this->cookie);
         if (stripos($page, 'The verification code is incorrect.') !== false) {
             $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
             $data['premium_acc'] = 'on';
             if ($this->pA) {
                 $data['pA_encrypted'] = 'true';
                 $data['premium_user'] = urlencode(encrypt($user));
                 // encrypt() will keep this safe.
                 $data['premium_pass'] = urlencode(encrypt($pass));
                 // And this too.
             }
             if (preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w\\.\\-]+)@i', $page, $cpid)) {
                 $data['step'] = '1';
                 $this->reCAPTCHA($pid[1], $data, 0, 'Login');
             } elseif (preg_match('@\\W(auth/captcha\\.html\\?v=\\w+)@i', $page, $cpid)) {
                 $data['step'] = '2';
                 list($headers, $imgBody) = explode("\r\n\r\n", $this->GetPage($purl . $cpid[1], $this->cookie), 2);
                 if (substr($headers, 9, 3) != '200') {
                     html_error('Error downloading captcha img.');
                 }
                 $mimetype = preg_match('@image/[\\w+]+@', $headers, $mimetype) ? $mimetype[0] : 'image/png';
                 $this->EnterCaptcha("data:{$mimetype};base64," . base64_encode($imgBody), $data, 20);
             } else {
                 html_error('Login CAPTCHA not found.');
             }
             exit;
         }
         is_present($page, 'Incorrect username or password', 'Login Failed: Email/Password incorrect.');
         is_present($page, 'You logged in from different country IP', 'Login Failed: Your account was locked for security reasons, to unlock your account check your email.');
         if (empty($this->cookie['c903aeaf0da94d1b365099298d28f38f'])) {
             html_error('Login Cookie Not Found.');
         }
         $page = $this->GetPage($purl, $this->cookie, 0, $purl . 'login.html');
         is_notpresent($page, '/auth/logout.html">Logout', 'Login Error.');
         $this->SaveCookies($user, $pass);
         // Update cookies file
         is_present($page, ' class="free">Free</', 'Account isn\'t premium');
         return $this->PremiumDL();
     }
     if ($_POST['step'] == '1') {
         if (empty($_POST['recaptcha_response_field'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         $post['LoginForm%5BverifyCode%5D'] = '';
         $post['recaptcha_challenge_field'] = urlencode($_POST['recaptcha_challenge_field']);
         $post['recaptcha_response_field'] = urlencode($_POST['recaptcha_response_field']);
     } else {
         if (empty($_POST['captcha'])) {
             html_error('You didn\'t enter the image verification code.');
         }
         $post['LoginForm%5BverifyCode%5D'] = urlencode($_POST['captcha']);
     }
     $_POST['step'] = false;
     $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
     $page = $this->GetPage($purl . 'login.html', $this->cookie, $post, $purl);
     $this->cookie = GetCookiesArr($page, $this->cookie);
     is_present($page, 'The verification code is incorrect.');
     is_present($page, 'Incorrect username or password', 'Login Failed: Email/Password incorrect.');
     is_present($page, 'You logged in from different country IP', 'Login Failed: Your account was locked for security reasons, to unlock your account check your email');
     if (empty($this->cookie['c903aeaf0da94d1b365099298d28f38f'])) {
         html_error('Login Cookie Not Found');
     }
     $page = $this->GetPage($purl, $this->cookie, 0, $purl . 'login.html');
     is_notpresent($page, '/auth/logout.html">Logout', 'Login Error.');
     $this->SaveCookies($user, $pass);
     // Update cookies file
     is_present($page, ' class="free">Free</', 'Account isn\'t premium');
     return $this->PremiumDL();
 }
function Login($user, $pass)
{
    global $upload_acc, $cookie, $domain, $referer, $pauth;
    if (!empty($_POST['step']) && $_POST['step'] == '1') {
        if (empty($_POST['captcha'])) {
            html_error('You didn\'t enter the image verification code.');
        }
        $cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
        $post = array();
        $post['user'] = urlencode($user);
        $post['pass'] = urlencode($pass);
        $post['captcha_code'] = urlencode($_POST['captcha']);
        $post['remember'] = 1;
        $post['login_submit'] = 'Login';
        $page = geturl($domain, 80, '/authenticate.php?login', $referer . 'authenticate.php?login', $cookie, $post, 0, $_GET['proxy'], $pauth);
        is_page($page);
        $cookie = GetCookiesArr($page, $cookie);
        if (stripos(substr($page, 0, strpos($page, "\r\n\r\n")), "\nLocation: ") !== false && preg_match('@\\nLocation: ((https?://[^/\\r\\n]+)?/authenticate\\.php[^\\r\\n]*)@i', substr($page, 0, strpos($page, "\r\n\r\n")), $redir)) {
            $url = parse_url(empty($redir[2]) ? 'http://www.putlocker.com' . $redir[1] : $redir[1]);
            $page = geturl($url['host'], defport($url), $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), $referer . 'authenticate.php?login', $cookie, 0, 0, $_GET['proxy'], $pauth);
            is_page($page);
            $cookie = GetCookiesArr($page, $cookie);
        }
        is_present($page, 'No such username or wrong password', 'Login Failed: Email/Password incorrect.');
        is_present($page, 'Please re-enter the captcha code', 'Login Failed: Wrong CAPTCHA entered.');
        if (empty($cookie['auth'])) {
            html_error('Login Error: Cannot find "auth" cookie.');
        }
        SaveCookies($user, $pass);
        // Update cookies file
        return true;
    } else {
        $page = geturl($domain, 80, '/authenticate.php?login', $referer . 'authenticate.php?login', $cookie, 0, 0, $_GET['proxy'], $pauth);
        is_page($page);
        $cookie = GetCookiesArr($page, $cookie);
        if (!preg_match('@(https?://[^/\\r\\n\\t\\s\'\\"<>]+)?/include/captcha\\.php\\?[^/\\r\\n\\t\\s\'\\"<>]+@i', $page, $imgurl)) {
            html_error('CAPTCHA not found.');
        }
        $imgurl = empty($imgurl[1]) ? 'http://www.putlocker.com' . $imgurl[0] : $imgurl[0];
        $imgurl = html_entity_decode($imgurl);
        //Download captcha img.
        $url = parse_url($imgurl);
        $page = geturl($url['host'], defport($url), $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), $referer . 'authenticate.php?login', $cookie, 0, 0, $_GET['proxy'], $pauth);
        is_page($page);
        $capt_img = substr($page, strpos($page, "\r\n\r\n") + 4);
        $imgfile = DOWNLOAD_DIR . 'putlocker_captcha.png';
        if (file_exists($imgfile)) {
            unlink($imgfile);
        }
        if (!write_file($imgfile, $capt_img)) {
            html_error('Error getting CAPTCHA image.');
        }
        $data = array();
        $data['action'] = 'FORM';
        $data['step'] = 1;
        $data['cookie'] = urlencode(encrypt(CookiesToStr($cookie)));
        $data['up_convert'] = !empty($_REQUEST['up_convert']) && $_REQUEST['up_convert'] == 'yes' ? 'yes' : 'no';
        EnterCaptcha($imgfile . '?' . time(), $data, $upload_acc['putlocker_com']['user'] && $upload_acc['putlocker_com']['pass']);
        exit;
    }
}
    echo "\t<tr><td colspan='2' align='center'><small>*You can set it as default in <b>" . $page_upload[$_REQUEST['uploaded']] . "</b></small></td></tr>\n";
    echo "</form>\n</table>\n";
} else {
    $not_done = false;
    if (substr($_T8['path'], 0, 1) != '/') {
        $_T8['path'] = '/' . $_T8['path'];
    }
    if (substr($_T8['path'], -1) != '/') {
        $_T8['path'] .= '/';
    }
    $_T8['port'] = !empty($_T8['port']) && $_T8['port'] > 0 && $_T8['port'] < 65536 ? (int) $_T8['port'] : 80;
    $scheme = $_T8['port'] == 443 ? 'https' : 'http';
    $referer = $scheme . '://' . $_T8['domain'] . $_T8['path'];
    // Login
    echo "<table style='width:600px;margin:auto;'>\n<tr><td align='center'>\n<div id='login' width='100%' align='center'>Login to " . str_ireplace('www.', '', $_T8['domain']) . "</div>\n";
    $cookie = !empty($cookie) ? is_array($cookie) ? $cookie : StrToCookies($cookie) : array();
    $cookie['lang'] = 'english';
    if ($_T8['xfsFree']) {
        $login = false;
    } elseif (!empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) {
        $post = array();
        $post['op'] = 'login';
        $post['redirect'] = '';
        $post['login'] = urlencode($_REQUEST['up_login']);
        $post['password'] = urlencode($_REQUEST['up_pass']);
        if (empty($_T8['fw_sendLogin']) || !is_callable($_T8['fw_sendLogin'])) {
            $page = geturl($_T8['domain'], $_T8['port'], $_T8['path'] . '?op=login', $referer, $cookie, $post, 0, $_GET['proxy'], $pauth, 0, $_T8['sslLogin'] ? 'https' : $scheme);
            is_page($page);
        } else {
            $page = call_user_func($_T8['fw_sendLogin'], $post);
        }
 private function loadCookie()
 {
     $filename = DOWNLOAD_DIR . 'billionuploads_com_cookie.php';
     if (!file_exists($filename)) {
         return false;
     }
     $file = file($filename);
     $cookies = decrypt(base64_decode($file[1]));
     unset($file);
     if (!empty($cookies)) {
         $this->cookie = StrToCookies($cookies);
         unset($this->cookie['aff']);
         return true;
     }
     return false;
 }