예제 #1
0
 public function Download($link)
 {
     if ($_REQUEST['step'] == '1') {
         $post['captcha'] = $_POST['captcha'];
         $post['submit'] = 'Download';
         $dlink = urldecode($_POST['referer']);
         $cookie = urldecode($_POST['cookie']);
         $link = urldecode($_POST['link']);
         $FileName = basename(parse_url($dlink, PHP_URL_PATH));
         $this->RedirectDownload($dlink, $FileName, $cookie, $post, $link);
         exit;
     } else {
         $page = $this->GetPage($link);
         is_present($page, "File not found.");
         $cookie = CookiesToStr(GetCookiesArr($page));
         if (preg_match('%<a href="([^"]+)" class="ajax button button-devil">%', $page, $match)) {
             $free = "http://download.hellshare.com" . $match[1];
         }
         $page = $this->GetPage($free, $cookie, 0, $link . "\r\nX-Requested-With: XMLHttpRequest");
         is_present($page, "The server is under the maximum load.");
         is_present($page, "You exceeded your today's limit for free download. You can download only 1 files per 24 hours.");
         $postlink = str_replace("\\", "", cut_str($page, 'style=\\"margin-bottom:0\\" action=\\"', '\\" method=\\"POST\\">'));
         $caplink = str_replace("\\", "", cut_str($page, 'id=\\"captcha-img\\"src=\\"', '\\" \\/>'));
         $data = $this->DefaultParamArr($link, $cookie, $postlink);
         $data['step'] = '1';
         $this->EnterCaptcha($caplink, $data);
         exit;
     }
 }
 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))));
     }
 }
예제 #3
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);
     }
 }
예제 #4
0
 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');
 }
예제 #5
0
 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);
 }
 public function Download($link)
 {
     global $premium_acc;
     $page = $this->GetPage($link);
     is_present($page, 'That file is not available for download');
     $CookieArr = GetCookiesArr($page);
     $cookie = CookiesToStr($CookieArr);
     $url = "http://filesflash.com/";
     $email = $_REQUEST["premium_user"] ? $_REQUEST["premium_user"] : $premium_acc["filesflash_com"]["user"];
     $pass = $_REQUEST["premium_pass"] ? $_REQUEST["premium_pass"] : $premium_acc["filesflash_com"]["pass"];
     if (!empty($email) && !empty($pass)) {
         $post = array();
         $post['email'] = urlencode($email);
         $post['password'] = urlencode($pass);
         $post['submit'] = 'Login';
         $page = $this->GetPage($url . "login.php", $cookie, $post, $url);
         is_present($page, "Invalid email address or password.");
         $cookie = CookiesToStr(array_merge($CookieArr, GetCookiesArr($page)));
         // check account
         $page = $this->GetPage($url . "myaccount.php", $cookie, 0, $url . "index.php");
         is_present($page, "<td>Premium Status:</td><td>Not Premium", "Account Status: Free");
         // start download link
         $page = $this->GetPage($link, $cookie);
         if (!preg_match("@Location: (http:\\/\\/[^\r\n]+)@i", $page, $dl)) {
             html_error("Error: Download Link [PREMIUM] not found!");
         }
         $dlink = trim($dl[1]);
         $filename = basename(parse_url($dlink, PHP_URL_PATH));
         $this->RedirectDownload($dlink, $filename, $cookie);
     } else {
         $post = array();
         $post['token'] = cut_str($page, 'name="token" value="', '"');
         $post['freedl'] = " Free Download ";
         $page = $this->GetPage($url . 'freedownload.php', $cookie, $post, $link);
         is_present($page, "Your link has expired. Please try again.");
         if (!preg_match('/count=(\\d+)/', $page, $wait)) {
             html_error("Error: Timer not found!");
         }
         $this->CountDown($wait[1]);
         $dlink = cut_str($page, '<div id="link" style="display:none"><a href="', '">');
         if (!$dlink) {
             html_error("Error: Download Link [FREE] not found???");
         }
         $FileName = basename(parse_url($dlink, PHP_URL_PATH));
         $this->RedirectDownload($dlink, $FileName, $cookie, 0, $url . 'freedownload.php');
         exit;
     }
 }
예제 #7
0
 private function FreeDL()
 {
     switch ($_POST['step']) {
         default:
             is_present($this->page, 'Your Traffic is used up for today!');
             if (!preg_match('@\\svar\\s+time\\s*=\\s*(\\d+)@i', $this->page, $cD)) {
                 html_error('Countdown not found.');
             }
             $this->cookie['ads_download'] = '1';
             if ($cD[1] >= 0) {
                 if ($cD[1] > 59) {
                     $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
                     $data['step'] = '1';
                     return $this->JSCountdown($cD[1] + 1, $data);
                 } else {
                     $this->CountDown($cD[1] + 1);
                 }
             }
         case '1':
             $page = $this->GetPage($this->link, $this->cookie, array('section' => 'benefit', 'did' => '0'));
             if (!preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w\\.\\-]+)@i', $page, $cpid)) {
                 html_error('CAPTCHA not found.');
             }
             $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
             $data['step'] = '2';
             return $this->reCAPTCHA($cpid[1], $data);
         case '2':
             break;
     }
     if (empty($_POST['recaptcha_response_field'])) {
         html_error('You didn\'t enter the image verification code.');
     }
     $post = array('recaptcha_challenge_field' => $_POST['recaptcha_challenge_field'], 'recaptcha_response_field' => $_POST['recaptcha_response_field']);
     $post['section'] = 'waitingtime';
     $post['did'] = '0';
     $page = $this->GetPage($this->link, $this->cookie, $post);
     is_present($page, 'Wrong Captcha!', 'Login Failed: Wrong CAPTCHA entered.');
     if (!preg_match($this->DLRegexp, $page, $DL)) {
         html_error('Download Link Not Found.');
     }
     $this->RedirectDownload($DL[0], 'T8_Freakshare_FDL');
 }
예제 #8
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))));
     }
 }
예제 #9
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();
 }
예제 #10
0
 private function QSelector()
 {
     $VR = array('>1080', 1080, 720, 480, 360, 270, 240, 144);
     $VC = array('MP4', 'WebM', 'FLV', '3GP');
     $AC = array('AAC', 'Vorbis', 'MP3');
     $AB = array(192, 128, 96, 64, 36, 24);
     $vinfo = array(38 => '0000', 37 => '1000', 46 => '1110', 22 => '2000', 45 => '2110', 44 => '3111', 35 => '3201', 43 => '4111', 34 => '4201', 18 => '4002', 6 => '5223', 5 => '6223', 36 => '6304', 17 => '7305');
     // VR VC AC AB
     $sizes = array();
     /* Add a // at the start of this line for enable this code.
     		if (extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec')) {
     			$sizes = array();
     			$opt = array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_NOBODY => true); // Redirects may fail with open_basedir enabled
     			foreach ($this->fmturlmaps as $fmt => $url) {
     				if (!in_array($fmt, $this->fmts)) continue;
     				$headers = explode("\r\n\r\n", cURL($url, $this->cookie, 0, 0, 0, $opt));
     				$headers = ((count($headers) > 2) ? $headers[count($headers) - 2] : $headers[0]) . "\r\n\r\n";
     				if (substr($headers, 9, 3) == '200' && ($CL = cut_str($headers, "\nContent-Length: ", "\n")) && $CL > 1024) $sizes[$fmt] = bytesToKbOrMbOrGb(trim($CL));
     			}
     			unset($headers, $CL);
     		} //*/
     echo "\n<br /><br /><h3 style='text-align: center;'>" . lang(216) . ".</h4>";
     echo "\n<center><form name='YT_QS' action='{$GLOBALS['PHP_SELF']}' method='POST'>\n";
     echo "<input type='hidden' name='yt_QS' value='on' />\n";
     echo '<label><input type="checkbox" name="cleanname" checked="checked" value="1" /><small>&nbsp;Remove non-supported characters from filename</small></label><br />';
     echo "<select name='yt_fmt' id='QS_fmt'>\n";
     foreach ($this->fmturlmaps as $fmt => $url) {
         if (in_array($fmt, $this->fmts) && ($I = str_split($vinfo[$fmt]))) {
             echo '<option ' . ($fmt == 18 ? "selected='selected' " : '') . "value='{$fmt}'>[{$fmt}] Video: {$VC[$I[1]]} {$VR[$I[0]]}p | Audio: {$AC[$I[2]]} ~{$AB[$I[3]]} kbps" . (!empty($sizes[$fmt]) ? ' (' . $sizes[$fmt] . ')' : '') . "</option>\n";
         }
     }
     echo "</select>\n";
     if (count($this->cookie) > 0) {
         $this->cookie = encrypt(CookiesToStr($this->cookie));
     }
     $data = $this->DefaultParamArr($this->link, $this->cookie);
     $data['ytube_mp4'] = 'on';
     foreach ($data as $n => $v) {
         echo "<input type='hidden' name='{$n}' id='QS_{$n}' value='{$v}' />\n";
     }
     echo "<input type='submit' name='Th3-822' value='" . lang(209) . "' />\n";
     echo "</form></center>\n</body>\n</html>";
     exit;
 }
예제 #11
0
function Login($user, $pass)
{
    global $default_acc, $cookie, $domain, $referer, $pauth;
    $errors = array('CaptchaInvalid' => 'Wrong CAPTCHA entered.', 'InvalidLogIn' => 'Invalid Login/Pass.', 'CaptchaRequired' => 'Captcha Required.');
    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%5Blogin%5D'] = urlencode($user);
        $post['user%5Bpass%5D'] = urlencode($pass);
        $post['user%5Bcaptcha_response%5D'] = urlencode($_POST['captcha']);
        $post['user%5Bcaptcha_type%5D'] = urlencode($_POST['c_type']);
        $post['user%5Bcaptcha_subtype%5D'] = !empty($_POST['c_subtype']) ? urlencode($_POST['c_subtype']) : '';
        $post['user%5Bmemory%5D'] = 'on';
        $post['user%5Bsubmit%5D'] = 'Login';
        $page = geturl($domain, 80, '/user/login', $referer, $cookie, $post, 0, $_GET['proxy'], $pauth);
        is_page($page);
        $cookie = GetCookiesArr($page, $cookie);
        $x = 0;
        while ($x < 3 && stripos($page, "\nLocation: ") !== false && preg_match('@\\nLocation: ((https?://[^/\\r\\n]+)?/[^\\r\\n]*)@i', $page, $redir)) {
            $redir = empty($redir[2]) ? 'http://turbobit.net' . $redir[1] : $redir[1];
            $url = parse_url($redir);
            $page = geturl($url['host'], defport($url), $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), $referer, $cookie, 0, 0, $_GET['proxy'], $pauth);
            is_page($page);
            $cookie = GetCookiesArr($page, $cookie);
            $x++;
        }
        is_present($page, 'Incorrect login or password', 'Login Failed: Login/Password incorrect.');
        is_present($page, 'E-Mail address appears to be invalid.', 'Login Failed: Invalid E-Mail.');
        is_present($page, 'Incorrect verification code', 'Login Failed: Wrong CAPTCHA entered.');
        if (empty($redir) || $redir != $referer) {
            $page = geturl($domain, 80, '/', $referer, $cookie, 0, 0, $_GET['proxy'], $pauth);
            is_page($page);
        }
        is_notpresent($page, '/user/logout">Logout<', 'Login Failed.');
        SaveCookies($user, $pass);
        // Update cookies file
        return $page;
    } else {
        $post = array();
        $post['user%5Blogin%5D'] = urlencode($user);
        $post['user%5Bpass%5D'] = urlencode($pass);
        $post['user%5Bmemory%5D'] = 'on';
        $post['user%5Bsubmit%5D'] = 'Login';
        $page = geturl($domain, 80, '/user/login', $referer, $cookie, $post, 0, $_GET['proxy'], $pauth);
        is_page($page);
        $cookie = GetCookiesArr($page, $cookie);
        if (!empty($cookie['user_isloggedin']) && $cookie['user_isloggedin'] == '1') {
            $page = geturl($domain, 80, '/', $referer, $cookie, $post, 0, $_GET['proxy'], $pauth);
            is_page($page);
            SaveCookies($user, $pass);
            // Update cookies file
            return $page;
        }
        $x = 0;
        while ($x < 3 && stripos($page, "\nLocation: ") !== false && preg_match('@\\nLocation: ((https?://[^/\\r\\n]+)?/[^\\r\\n]*)@i', $page, $redir)) {
            $redir = empty($redir[2]) ? 'http://turbobit.net' . $redir[1] : $redir[1];
            $url = parse_url($redir);
            $page = geturl($url['host'], defport($url), $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), $referer, $cookie, 0, 0, $_GET['proxy'], $pauth);
            is_page($page);
            $cookie = GetCookiesArr($page, $cookie);
            $x++;
        }
        if ($x < 1) {
            html_error('Login redirect not found');
        }
        is_present($page, 'Incorrect login or password', 'Login Failed: Login/Password incorrect');
        is_present($page, 'E-Mail address appears to be invalid.', 'Login Failed: Invalid E-Mail');
        if (!preg_match('@(https?://[^/\\r\\n\\t\\s\'\\"<>]+)?/captcha/[^\\r\\n\\t\\s\'\\"<>]+@i', $page, $imgurl)) {
            if (stripos($page, '/user/logout">Logout<') !== false) {
                $this->SaveCookies($user, $pass);
                // Update cookies file
                is_present($page, '<u>Turbo Access</u> denied', 'Login Failed: Account isn\'t premium');
                return $this->PremiumDL();
            } else {
                html_error('CAPTCHA not found.');
            }
        }
        $imgurl = empty($imgurl[1]) ? 'http://turbobit.net' . $imgurl[0] : $imgurl[0];
        $imgurl = html_entity_decode($imgurl);
        if (!preg_match('@\\Wvalue\\s*=\\s*[\'\\"]([^\'\\"\\r\\n<>]+)[\'\\"]\\s+name\\s*=\\s*[\'\\"]user\\[captcha_type\\][\'\\"]@i', $page, $c_type) || !preg_match('@\\Wvalue\\s*=\\s*[\'\\"]([^\'\\"\\r\\n<>]*)[\'\\"]\\s+name\\s*=\\s*[\'\\"]user\\[captcha_subtype\\][\'\\"]@i', $page, $c_subtype)) {
            html_error('CAPTCHA data not found.');
        }
        //Download captcha img.
        $url = parse_url($imgurl);
        $page = geturl($url['host'], defport($url), $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), $referer, $cookie, 0, 0, $_GET['proxy'], $pauth);
        is_page($page);
        $capt_img = substr($page, strpos($page, "\r\n\r\n") + 4);
        $imgfile = DOWNLOAD_DIR . 'turbobit_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['cookie'] = urlencode(encrypt(CookiesToStr($cookie)));
        $data['step'] = '1';
        $data['c_type'] = urlencode($c_type[1]);
        $data['c_subtype'] = urlencode($c_subtype[1]);
        if (!$default_acc) {
            $data['up_encrypted'] = 'true';
            $data['up_login'] = urlencode(encrypt($user));
            $data['up_pass'] = urlencode(encrypt($pass));
        }
        EnterCaptcha($imgfile . '?' . time(), $data);
        exit;
    }
}
예제 #12
0
 private function QSelector($link)
 {
     global $PHP_SELF;
     $fmtlangs = array(38 => 377, 37 => 228, 22 => 227, 45 => 225, 35 => 223, 44 => 389, 34 => 222, 43 => 224, 18 => 226, 5 => 221, 17 => 220);
     $sizes = array();
     /* Add a // at the start of this line for enable this code.
     		if (extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec')) {
     			$sizes = array();
     			$opt = array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_NOBODY => true); // Redirects may fail with open_basedir enabled
     			if (!empty($this->cookie)) $opt[CURLOPT_COOKIE] = CookiesToStr($this->cookie);
     			foreach ($this->fmturlmaps as $fmt => $url) {
     				if (!in_array($fmt, $this->fmts)) continue;
     				$headers = explode("\r\n\r\n", cURL($url, $this->cookie, 0, 0, 0, $opt));
     				$headers = ((count($headers) > 2) ? $headers[count($headers) - 2] : $headers[0]) . "\r\n\r\n";
     				if (substr($headers, 9, 3) == '200' && ($CL = cut_str($headers, "\nContent-Length: ", "\n")) && $CL > 1024) $sizes[$fmt] = bytesToKbOrMbOrGb(trim($CL));
     			}
     			unset($headers, $CL);
     		} //*/
     echo "\n<br /><br /><h3 style='text-align: center;'>" . lang(216) . ".</h4>";
     echo "\n<center><form name='YT_QS' action='{$PHP_SELF}' method='POST'>\n";
     echo "<input type='hidden' name='yt_QS' value='on' />\n";
     echo "<select name='yt_fmt' class='btn btn-inverse dropdown-toggle'> id='QS_fmt'>\n";
     foreach ($this->fmturlmaps as $fmt => $url) {
         if (in_array($fmt, $this->fmts)) {
             echo '<option ' . ($fmt == 18 ? "selected='selected' " : '') . "value='{$fmt}'>" . lang($fmtlangs[$fmt]) . (!empty($sizes[$fmt]) ? ' (' . $sizes[$fmt] . ')' : '') . "</option>\n";
         }
     }
     echo "</select>\n";
     if (count($this->cookie) > 0) {
         $this->cookie = encrypt(CookiesToStr($this->cookie));
     }
     $data = $this->DefaultParamArr($link, $this->cookie);
     $data['ytube_mp4'] = 'on';
     foreach ($data as $n => $v) {
         echo "<input type='hidden' name='{$n}' id='QS_{$n}' value='{$v}' />\n";
     }
     echo "<input type='submit' class='btn btn-success' name='submit' value='" . lang(209) . "' />\n";
     echo "</form></center>\n</body>\n</html>";
     exit;
 }
예제 #13
0
function putfile($host, $port, $url, $referer, $cookie, $file, $filename, $proxy = 0, $pauth = 0, $upagent = 0, $scheme = 'http')
{
    global $nn, $lastError, $fp, $fs;
    if (empty($upagent)) {
        $upagent = rl_UserAgent;
    }
    $scheme = strtolower("{$scheme}://");
    if (!is_readable($file)) {
        $lastError = sprintf(lang(65), $file);
        return FALSE;
    }
    $fileSize = getSize($file);
    if (!empty($cookie)) {
        if (is_array($cookie)) {
            $cookies = count($cookie) > 0 ? CookiesToStr($cookie) : 0;
        } else {
            $cookies = trim($cookie);
        }
    }
    if ($scheme == 'https://') {
        if (!extension_loaded('openssl')) {
            html_error('You need to install/enable PHP\'s OpenSSL extension to support uploading via HTTPS.');
        }
        $scheme = 'tls://';
        if ($port == 0 || $port == 80) {
            $port = 443;
        }
    }
    if (!empty($referer) && ($pos = strpos("\r\n", $referer)) !== 0) {
        $origin = parse_url($pos ? substr($referer, 0, $pos) : $referer);
        $origin = strtolower($origin['scheme']) . '://' . strtolower($origin['host']) . (!empty($origin['port']) && $origin['port'] != defport(array('scheme' => $origin['scheme'])) ? ':' . $origin['port'] : '');
    } else {
        $origin = ($scheme == 'tls://' ? 'https://' : $scheme) . $host . ($port != 80 && ($scheme != 'tls://' || $port != 443) ? ':' . $port : '');
    }
    if ($proxy) {
        list($proxyHost, $proxyPort) = explode(':', $proxy, 2);
        $host = $host . ($port != 80 && ($scheme != 'tls://' || $port != 443) ? ':' . $port : '');
        $url = "{$scheme}{$host}{$url}";
    }
    if ($scheme != 'tls://') {
        $scheme = '';
    }
    $request = array();
    $request[] = 'PUT ' . str_replace(' ', '%20', $url) . ' HTTP/1.1';
    $request[] = "Host: {$host}";
    $request[] = "User-Agent: {$upagent}";
    $request[] = 'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1';
    $request[] = 'Accept-Language: en-US,en;q=0.9';
    $request[] = 'Accept-Charset: utf-8,windows-1251;q=0.7,*;q=0.7';
    if (!empty($referer)) {
        $request[] = "Referer: {$referer}";
    }
    if (!empty($cookies)) {
        $request[] = "Cookie: {$cookies}";
    }
    if (!empty($pauth)) {
        $request[] = "Proxy-Authorization: Basic {$pauth}";
    }
    $request[] = "X-File-Name: {$filename}";
    $request[] = "X-File-Size: {$fileSize}";
    $request[] = "Origin: {$origin}";
    $request[] = 'Content-Disposition: attachment';
    $request[] = 'Content-Type: multipart/form-data';
    $request[] = "Content-Length: {$fileSize}";
    $request[] = 'Connection: Close';
    $request = implode($nn, $request) . $nn . $nn;
    $errno = 0;
    $errstr = '';
    $hosts = (!empty($proxyHost) ? $scheme . $proxyHost : $scheme . $host) . ':' . (!empty($proxyPort) ? $proxyPort : $port);
    $fp = @stream_socket_client($hosts, $errno, $errstr, 120, STREAM_CLIENT_CONNECT);
    if (!$fp) {
        if (!function_exists('stream_socket_client')) {
            html_error('[ERROR] stream_socket_client() is disabled.');
        }
        $dis_host = !empty($proxyHost) ? $proxyHost : $host;
        $dis_port = !empty($proxyPort) ? $proxyPort : $port;
        html_error(sprintf(lang(88), $dis_host, $dis_port));
    }
    if ($errno || $errstr) {
        $lastError = $errstr;
        return false;
    }
    if ($proxy) {
        echo '<p>' . sprintf(lang(89), $proxyHost, $proxyPort) . '<br />PUT: <b>' . htmlspecialchars($url) . "</b>...<br />\n";
    } else {
        echo '<p>' . sprintf(lang(90), $host, $port) . '</p>';
    }
    echo lang(104) . ' <b>' . htmlspecialchars($filename) . '</b>, ' . lang(56) . ' <b>' . bytesToKbOrMbOrGb($fileSize) . '</b>...<br />';
    $GLOBALS['id'] = md5(time() * rand(0, 10));
    require TEMPLATE_DIR . '/uploadui.php';
    flush();
    $timeStart = microtime(true);
    $chunkSize = GetChunkSize($fileSize);
    fwrite($fp, $request);
    fflush($fp);
    $fs = fopen($file, 'r');
    $totalsend = $time = $lastChunkTime = 0;
    while (!feof($fs) && !$errno && !$errstr) {
        $data = fread($fs, $chunkSize);
        if ($data === false) {
            fclose($fs);
            fclose($fp);
            html_error(lang(112));
        }
        $sendbyte = @fwrite($fp, $data);
        fflush($fp);
        if ($sendbyte === false || strlen($data) > $sendbyte) {
            fclose($fs);
            fclose($fp);
            html_error(lang(113));
        }
        $totalsend += $sendbyte;
        $time = microtime(true) - $timeStart;
        $chunkTime = $time - $lastChunkTime;
        $chunkTime = $chunkTime > 0 ? $chunkTime : 1;
        $lastChunkTime = $time;
        $speed = round($sendbyte / 1024 / $chunkTime, 2);
        $percent = round($totalsend / $fileSize * 100, 2);
        echo "<script type='text/javascript'>pr('{$percent}', '" . bytesToKbOrMbOrGb($totalsend) . "', '{$speed}');</script>\n";
        flush();
    }
    if ($errno || $errstr) {
        $lastError = $errstr;
        return false;
    }
    fclose($fs);
    fflush($fp);
    $llen = 0;
    $header = '';
    do {
        $header .= fgets($fp, 16384);
        $len = strlen($header);
        if (!$header || $len == $llen) {
            $lastError = lang(91);
            stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
            fclose($fp);
            return false;
        }
        $llen = $len;
    } while (strpos($header, $nn . $nn) === false);
    // Array for active stream filters
    $sFilters = array();
    if (stripos($header, "\nTransfer-Encoding: chunked") !== false && in_array('dechunk', stream_get_filters())) {
        $sFilters['dechunk'] = stream_filter_append($fp, 'dechunk', STREAM_FILTER_READ);
    }
    // Add built-in dechunk filter
    $page = '';
    do {
        $data = @fread($fp, 16384);
        if ($data == '') {
            break;
        }
        $page .= $data;
    } while (!feof($fp) && strlen($data) > 0);
    stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
    fclose($fp);
    if (stripos($header, "\nTransfer-Encoding: chunked") !== false && empty($sFilters['dechunk']) && function_exists('http_chunked_decode')) {
        $dechunked = http_chunked_decode($page);
        if ($dechunked !== false) {
            $page = $dechunked;
        }
        unset($dechunked);
    }
    $page = $header . $page;
    return $page;
}
     }
     $imgurl = empty($imgurl[1]) ? 'http://rapidgator.net' . $imgurl[0] : $imgurl[0];
     //Download captcha img.
     $capt_page = cURL($imgurl, $cookie, 0, $referer);
     $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 = array();
     $data['step'] = '1';
     $data['cookie'] = urlencode(encrypt(CookiesToStr($cookie)));
     $data['action'] = 'FORM';
     // I should add 'premium_acc' to DefaultParamArr()
     if (!$default_acc) {
         $data['A_encrypted'] = 'true';
         $data['up_login'] = urlencode(encrypt($_REQUEST['up_login']));
         // encrypt() will keep this safe.
         $data['up_pass'] = urlencode(encrypt($_REQUEST['up_pass']));
         // And this too.
     }
     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)');
 is_present($page, 'The code from a picture does not coincide', 'Login Failed: Captcha... (T8: I will add it later)');
 if (empty($cookie['user__'])) {
예제 #15
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();
 }
예제 #16
0
 private function FreeDL($link)
 {
     if (empty($_POST['step']) || $_POST['step'] != '1') {
         $page2 = cut_str($this->page, 'Form method="POST" action=\'', '</form>');
         //Cutting page
         $post = array();
         $post['op'] = cut_str($page2, 'name="op" value="', '"');
         is_notpresent($post['op'], 'download', 'Error parsing download post data.');
         $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'] = cut_str($page2, 'name="method_free" value="', '"');
         $page = $this->GetPage($link, $this->cookie, $post);
         if (preg_match('@You can download files up to \\d+ [K|M|G]b only.@i', $page, $err)) {
             html_error("Error: " . $err[0]);
         }
         if (preg_match('@You (?:(?:have to)|(?:must)) wait (?:\\d+ \\w+,\\s)?\\d+ \\w+ (?:un)?till? (?:your )?next download@', $page, $err)) {
             html_error("Error: " . $err[0]);
         }
         $page2 = cut_str($page, '<form name="F1" method="POST"', '</form>');
         //Cutting page
         if (!preg_match('@<span id="countdown_str">[^<|>]+<span[^>]*>(\\d+)</span>[^<|>]+</span>@i', $page2, $count)) {
             $count = array(1 => 30);
         }
         if ($count[1] > 0) {
             $this->CountDown($count[1]);
         }
         if (!preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w|\\-]+)@i', $page, $pid)) {
             html_error('Error: reCAPTCHA not found.');
         }
         $data = $this->DefaultParamArr($link, empty($this->cookie['xfss']) ? 0 : encrypt(CookiesToStr($this->cookie)));
         $post = array();
         $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]'] = cut_str($page2, 'name="method_free" value="', '"');
         $data['step'] = 1;
         $this->Show_reCaptcha($pid[1], $data);
     } else {
         if (empty($_POST['recaptcha_response_field'])) {
             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['recaptcha_challenge_field'], 'recaptcha_response_field' => $_POST['recaptcha_response_field']);
         $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, "Wrong captcha", "Error: Wrong captcha.");
         is_present($page, "Skipped countdown", "Error: Skipped countdown?.");
         if (preg_match('@You (?:(?:have to)|(?:must)) wait (?:\\d+ \\w+,\\s)?\\d+ \\w+ (?:un)?till? (?:your )?next download@', $page, $err)) {
             html_error("Error: " . $err[0]);
         }
         if (!preg_match('@href="(https?://[^/|\\"]+/(?:(?:files)|(?:dl?))/[^\\"|>]+)"@i', $page, $dlink)) {
             html_error('Error: Download link not found.');
         }
         $FileName = urldecode(basename(parse_url($dlink[1], PHP_URL_PATH)));
         $this->RedirectDownload($dlink[1], $FileName);
     }
 }
예제 #17
0
 private function Login($user, $pass)
 {
     $purl = 'http://turbobit.net/';
     if (!empty($_POST['step']) && ($_POST['step'] == '1' || $_POST['step'] == '2')) {
         $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
         $post = array();
         $post['user%5Blogin%5D'] = urlencode($user);
         $post['user%5Bpass%5D'] = urlencode($pass);
         if ($_POST['step'] == '1') {
             if (empty($_POST['captcha'])) {
                 html_error('You didn\'t enter the image verification code.');
             }
             $post['user%5Bcaptcha_response%5D'] = urlencode($_POST['captcha']);
         } else {
             if (empty($_POST['recaptcha_response_field'])) {
                 html_error('You didn\'t enter the image verification code.');
             }
             $post['recaptcha_challenge_field'] = urlencode($_POST['recaptcha_challenge_field']);
             $post['recaptcha_response_field'] = urlencode($_POST['recaptcha_response_field']);
         }
         $post['user%5Bcaptcha_type%5D'] = urlencode($_POST['c_type']);
         $post['user%5Bcaptcha_subtype%5D'] = !empty($_POST['c_subtype']) ? urlencode($_POST['c_subtype']) : '';
         $post['user%5Bmemory%5D'] = 'on';
         $post['user%5Bsubmit%5D'] = 'Login';
         $page = $this->GetPage($purl . 'user/login', $this->cookie, $post, $purl . 'login');
         $this->cookie = GetCookiesArr($page, $this->cookie);
         $x = 0;
         while ($x < 3 && stripos($page, "\nLocation: ") !== false && preg_match('@\\nLocation: ((https?://[^/\\r\\n]+)?/[^\\r\\n]*)@i', $page, $redir)) {
             $redir = empty($redir[2]) ? 'http://turbobit.net' . $redir[1] : $redir[1];
             $page = $this->GetPage($redir, $this->cookie);
             $this->cookie = GetCookiesArr($page, $this->cookie);
             $x++;
         }
         is_present($page, 'Incorrect login or password', 'Login Failed: Login/Password incorrect.');
         is_present($page, 'E-Mail address appears to be invalid.', 'Login Failed: Invalid E-Mail.');
         is_present($page, 'Username(Email) does not exist', 'Login Failed: E-Mail is not registered.');
         is_present($page, 'Incorrect verification code', 'Login Failed: Wrong CAPTCHA entered.');
         is_present($page, 'Incorrect captcha code', 'Login Failed: Wrong Recaptcha entered.');
         // is_present($page, 'Limit of login attempts exceeded for your account. It has been temporarily locked.', 'Login Failed: Account Temporally Locked.');
         if (empty($redir) || $redir != $purl) {
             $page = $this->GetPage($purl, $this->cookie, 0, $purl);
         }
         is_notpresent($page, '/user/logout">Logout<', 'Login Failed.');
         $this->SaveCookies($user, $pass);
         // Update cookies file
         is_present($page, '<u>Turbo Access</u> denied', 'Login Failed: Account isn\'t premium.');
         return $this->PremiumDL();
     } else {
         $post = array();
         $post['user%5Blogin%5D'] = urlencode($user);
         $post['user%5Bpass%5D'] = urlencode($pass);
         $post['user%5Bmemory%5D'] = 'on';
         $post['user%5Bsubmit%5D'] = 'Login';
         $page = $this->GetPage($purl . 'user/login', $this->cookie, $post, $purl . 'login');
         $this->cookie = GetCookiesArr($page, $this->cookie);
         if (!empty($this->cookie['user_isloggedin']) && $this->cookie['user_isloggedin'] == '1') {
             $page = $this->GetPage($purl, $this->cookie, 0, $purl);
             $this->SaveCookies($user, $pass);
             // Update cookies file
             is_present($page, '<u>Turbo Access</u> denied', 'Login Failed: Account isn\'t premium');
             return $this->PremiumDL();
         }
         $x = 0;
         while ($x < 3 && stripos($page, "\nLocation: ") !== false && preg_match('@\\nLocation: ((https?://[^/\\r\\n]+)?/[^\\r\\n]*)@i', $page, $redir)) {
             $redir = empty($redir[2]) ? 'http://turbobit.net' . $redir[1] : $redir[1];
             $page = $this->GetPage($redir, $this->cookie);
             $this->cookie = GetCookiesArr($page, $this->cookie);
             $x++;
         }
         if ($x < 1) {
             html_error('Login redirect not found');
         }
         is_present($page, 'Incorrect login or password', 'Login Failed: Login/Password incorrect');
         is_present($page, 'E-Mail address appears to be invalid.', 'Login Failed: Invalid E-Mail');
         is_present($page, 'Username(Email) does not exist', 'Login Failed: E-Mail is not registered.');
         // is_present($page, 'Limit of login attempts exceeded for your account. It has been temporarily locked.', 'Login Failed: Account Temporally Locked');
         if (preg_match('@(https?://[^/\\r\\n\\t\\s\'\\"<>]+)?/captcha/[^\\r\\n\\t\\s\'\\"<>]+@i', $page, $imgurl)) {
             $imgurl = empty($imgurl[1]) ? 'http://turbobit.net' . $imgurl[0] : $imgurl[0];
             $imgurl = html_entity_decode($imgurl);
             if (!preg_match('@\\Wvalue\\s*=\\s*[\'\\"]([^\'\\"\\r\\n<>]+)[\'\\"]\\s+name\\s*=\\s*[\'\\"]user\\[captcha_type\\][\'\\"]@i', $page, $c_type) || !preg_match('@\\Wvalue\\s*=\\s*[\'\\"]([^\'\\"\\r\\n<>]*)[\'\\"]\\s+name\\s*=\\s*[\'\\"]user\\[captcha_subtype\\][\'\\"]@i', $page, $c_subtype)) {
                 html_error('CAPTCHA data not found.');
             }
             //Download captcha img.
             $capt_page = $this->GetPage($imgurl, $this->cookie);
             $capt_img = substr($capt_page, strpos($capt_page, "\r\n\r\n") + 4);
             $imgfile = DOWNLOAD_DIR . 'turbobit_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['c_type'] = urlencode($c_type[1]);
             $data['c_subtype'] = urlencode($c_subtype[1]);
             $data['premium_acc'] = 'on';
             // I should add 'premium_acc' to DefaultParamArr()
             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.
             }
             $this->EnterCaptcha($imgfile . '?' . time(), $data);
             exit;
         } elseif (preg_match('@https?://(?:[^/]+\\.)?(?:(?:google\\.com/recaptcha/api)|(?:recaptcha\\.net))/(?:(?:challenge)|(?:noscript))\\?k=([\\w\\.\\-]+)@i', $page, $pid)) {
             $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
             $data['step'] = '2';
             $data['c_type'] = 'recaptcha';
             $data['premium_acc'] = 'on';
             // I should add 'premium_acc' to DefaultParamArr()
             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.
             }
             $this->reCAPTCHA($pid[1], $data, 0, 'Login');
             exit;
         } elseif (stripos($page, '/user/logout">Logout<') !== false) {
             $this->SaveCookies($user, $pass);
             // Update cookies file
             is_present($page, '<u>Turbo Access</u> denied', 'Login Failed: Account isn\'t premium');
             return $this->PremiumDL();
         } else {
             html_error('CAPTCHA not found.');
         }
     }
 }
예제 #18
0
 private function Premium($password = false)
 {
     if ($password == true) {
         $post['code'] = $_POST['code'];
         $post['file_pass'] = $_POST['password'];
         $post['token'] = $_POST['token'];
         $Url = urldecode($_POST['link']);
         $this->Cookies = decrypt(urldecode($_POST['cookie']));
         $this->page = $this->GetPage($Url, $this->Cookies, $post, $this->link);
         if (!preg_match('@"js":\\{"(\\w+)":\\{?"([^"]+)"?:?"?([^|\\r|\\n|"]+)?"\\}@i', $this->page, $match)) {
             html_error("Error: Unknown Password Link [PREMIUM] page response, plugin need to be updated!");
         }
         switch ($match[1]) {
             case 'error':
                 echo "<center><font color='red'><b>{$match['2']}</b></font></center>";
                 $data = $this->DefaultParamArr($Url, encrypt($this->Cookies), $this->link);
                 $data['step'] = 'Passpre';
                 $data['code'] = $_POST['code'];
                 $data['token'] = $_POST['token'];
                 $this->EnterPassword($data);
                 break;
             case 'answer':
                 switch ($match[2]) {
                     case 'link':
                         $dlink = str_replace('\\', '', $match[3]);
                         $filename = basename(parse_url($dlink, PHP_URL_PATH));
                         $this->RedirectDownload($dlink, $filename, $this->Cookies);
                         break;
                 }
                 break;
         }
     } else {
         $this->page = $this->GetPage($this->link, $this->Cookies, 0, $this->link);
         is_present($this->page, "You can only download 50GB a day");
         if (strpos($this->page, 'var is_pass_exists = true')) {
             if (!preg_match("@code: '([^']+)',@", $this->page, $code) || !preg_match("@[({]token: '([^']+)',@", $this->page, $token)) {
                 html_error('Error: Post Password Data [Premium] not found!');
             }
             $Url = "http://filepost.com/files/get/?SID={$this->Cookies['SID']}&JsHttpRequest=" . jstime() . "-xml";
             $data = $this->DefaultParamArr($Url, encrypt(CookiesToStr($this->Cookies)), $this->link);
             $data['code'] = $code[1];
             $data['token'] = $token[1];
             $data['step'] = 'Passpre';
             $this->EnterPassword($data);
             exit;
         }
         if (!preg_match('@http(s)?:\\/\\/fs\\d+\\.filepost\\.com\\/get_file\\/[^|\\r|\\n|\']+@i', $this->page, $dl)) {
             html_error("Error: Download Link [PREMIUM] non password not found!");
         }
         $dlink = trim($dl[0]);
         $filename = basename(parse_url($dlink, PHP_URL_PATH));
         $this->RedirectDownload($dlink, $filename, $this->Cookies);
     }
 }
예제 #19
0
 private function Login($user, $pass)
 {
     $purl = 'http://www.putlocker.com/';
     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 = array();
         $post['user'] = urlencode($user);
         $post['pass'] = urlencode($pass);
         $post['captcha_code'] = urlencode($_POST['captcha']);
         $post['remember'] = 1;
         $post['login_submit'] = 'Login';
         $page = $this->GetPage($purl . 'authenticate.php?login', $this->cookie, $post, $purl . 'authenticate.php?login');
         $this->cookie = GetCookiesArr($page, $this->cookie);
         if (stripos($page, "\r\nLocation: ") !== false && preg_match('@Location: ((https?://[^/\\r\\n]+)?/authenticate\\.php[^\\r\\n]*)@i', $page, $redir)) {
             $redir = empty($redir[2]) ? 'http://www.putlocker.com' . $redir[1] : $redir[1];
             $page = $this->GetPage($redir, $this->cookie);
             $this->cookie = GetCookiesArr($page, $this->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($this->cookie['auth'])) {
             html_error('Login Error: Cannot find "auth" cookie.');
         }
         $page = $this->GetPage($purl, $this->cookie, 0, $purl . 'authenticate.php?login');
         is_present($page, '>( Free )<', 'Account isn\'t premium');
         $this->SaveCookies($user, $pass);
         // Update cookies file
         return $this->PremiumDL();
     } else {
         $page = $this->GetPage($purl . 'authenticate.php?login', $this->cookie, 0, $purl);
         $this->cookie = GetCookiesArr($page, $this->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.
         $page = $this->GetPage($imgurl, $this->cookie);
         $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 = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
         $data['step'] = 1;
         $data['premium_acc'] = 'on';
         // I should add 'premium_acc' to DefaultParamArr()
         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.
         }
         $this->EnterCaptcha($imgfile . '?' . time(), $data);
         exit;
     }
 }
예제 #20
0
function Login($user, $pass)
{
    global $cookie, $domain, $referer, $pauth, $default_acc;
    $post = array();
    $post['LoginForm%5Busername%5D'] = urlencode($user);
    $post['LoginForm%5Bpassword%5D'] = urlencode($pass);
    $post['LoginForm%5BrememberMe%5D'] = 1;
    if (empty($_POST['step']) || !in_array($_POST['step'], array('1', '2'))) {
        $page = geturl($domain, 80, '/login.html', $referer, 0, $post, 0, $_GET['proxy'], $pauth);
        is_page($page);
        $cookie = GetCookiesArr($page);
        if (stripos($page, 'The verification code is incorrect.') !== false) {
            $data = array();
            $data['cookie'] = urlencode(encrypt(CookiesToStr($cookie)));
            $data['action'] = 'FORM';
            if (!$default_acc) {
                $data['A_encrypted'] = 'true';
                $data['up_login'] = urlencode(encrypt($user));
                // encrypt() will keep this safe.
                $data['up_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';
                reCAPTCHA($pid[1], $data, 'Login');
            } elseif (preg_match('@\\W(auth/captcha\\.html\\?v=\\w+)@i', $page, $cpid)) {
                $data['step'] = '2';
                $imgReq = geturl($domain, 80, '/' . $cpid[1], $referer, $cookie, 0, 0, $_GET['proxy'], $pauth);
                is_page($imgReq);
                list($headers, $imgBody) = explode("\r\n\r\n", $imgReq, 2);
                unset($imgReq);
                if (substr($headers, 9, 3) != '200') {
                    html_error('Error downloading captcha img.');
                }
                $mimetype = preg_match('@image/[\\w+]+@', $headers, $mimetype) ? $mimetype[0] : 'image/png';
                EnterCaptcha("data:{$mimetype};base64," . base64_encode($imgBody), $data, 20, 'Login');
            } 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($cookie['c903aeaf0da94d1b365099298d28f38f'])) {
            html_error('Login Cookie Not Found.');
        }
        if (empty($cookie['sessid'])) {
            html_error('Session Cookie Not Found.');
        }
        $test = k2s_apireq('test');
        if ($test['code'] != 403) {
            k2s_checkErrors($test, 'Login error');
        } else {
            $page = geturl($domain, 80, '/', $referer . 'login.html', $cookie, 0, 0, $_GET['proxy'], $pauth);
            is_page($page);
            is_notpresent($page, '/auth/logout.html">Logout', 'Login Error.');
        }
        SaveCookies($user, $pass);
        // Update cookies file
        return true;
    }
    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;
    $cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
    $page = geturl($domain, 80, '/login.html', $referer, $cookie, $post, 0, $_GET['proxy'], $pauth);
    is_page($page);
    $cookie = GetCookiesArr($page, $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($cookie['c903aeaf0da94d1b365099298d28f38f'])) {
        html_error('Login Cookie Not Found');
    }
    if (empty($cookie['sessid'])) {
        html_error('Session Cookie Not Found');
    }
    $test = k2s_apireq('test');
    if ($test['code'] != 403) {
        k2s_checkErrors($test, 'Login Error');
    } else {
        $page = geturl($domain, 80, '/', $referer . 'login.html', $cookie, 0, 0, $_GET['proxy'], $pauth);
        is_page($page);
        is_notpresent($page, '/auth/logout.html">Logout', 'Login Error');
    }
    SaveCookies($user, $pass);
    // Update cookies file
    return true;
}
예제 #21
0
 private function RetrieveCaptcha()
 {
     $page = $this->GetPage($this->link, $this->cookie);
     is_present($page, '/404.html', 'No such file or the file has been removed due to copyright infringement issues.');
     $form = cut_str($page, '<form id="captchaForm"', '</form>');
     if (!preg_match('/https?:\\/\\/api\\.solvemedia\\.com\\/papi\\/challenge\\.noscript\\?k=[^\\r\\n"]+/i', $form, $c)) {
         html_error('Error[Captcha Data not found!]');
     }
     $challenge = $this->GetPage($c[0], 0, 0, $this->link);
     $cookieapi = GetCookiesArr($challenge);
     if (!preg_match_all('/<input type=hidden name="([^"]+)"( id="([^"]+)")? value="([^"]+)"?/', $challenge, $tmp)) {
         html_error('Error[Post Data Captcha not found!]');
     }
     $tmp = array_combine($tmp[1], $tmp[4]);
     if (!preg_match('@<img [^/|<|>]*src\\s?=\\s?\\"(/papi/media\\?c=[^\\"|<|>]+)\\"@i', $challenge, $ch)) {
         html_error('CAPTCHA img not found.');
     }
     $imgurl = 'http://api.solvemedia.com' . $ch[1];
     $cap = $this->GetPage($imgurl, $cookieapi);
     $capt_img = substr($cap, strpos($cap, "\r\n\r\n") + 4);
     $imgfile = DOWNLOAD_DIR . 'vidbux_captcha.gif';
     if (file_exists($imgfile)) {
         unlink($imgfile);
     }
     if (!write_file($imgfile, $capt_img)) {
         html_error('Error getting CAPTCHA image.');
     }
     if (!preg_match_all('/<input name="([^"]+)" type="hidden" value="([^"]+)?"\\/?>/', $form, $match)) {
         html_error('Error[Post Data - FREE not found!]');
     }
     $match = array_combine($match[1], $match[2]);
     $data = $this->DefaultParamArr($this->link, $this->cookie);
     foreach ($match as $k => $v) {
         $data["post[{$k}]"] = $v;
     }
     foreach ($tmp as $k => $v) {
         $data["postcap[{$k}]"] = $v;
     }
     $data['imgurl'] = urlencode($imgurl);
     $data['cookieapi'] = urlencode(CookiesToStr($cookieapi));
     $data['step'] = '1';
     $this->EnterCaptcha($imgfile . '?' . time(), $data, 20);
     exit;
 }
예제 #22
0
 public function DefaultParamArr($link = 0, $cookie = 0, $referer = 1, $encrypt = 0)
 {
     if ($referer === 1 || $referer === true) {
         global $Referer;
         $referer = $Referer;
     }
     if (is_array($cookie)) {
         $cookie = CookiesToStr($cookie);
     }
     if ($encrypt) {
         $cookie = encrypt($cookie);
     }
     $DParam = GetDefaultParams();
     if ($link) {
         $DParam['link'] = urlencode($link);
     }
     if ($cookie) {
         $DParam['cookie'] = urlencode($cookie);
     }
     if ($referer) {
         $DParam['referer'] = urlencode($referer);
     }
     return $DParam;
 }
예제 #23
0
 protected function showCaptcha($step)
 {
     if ($captcha = $this->findCaptcha()) {
         $data = $this->DefaultParamArr($this->link, empty($this->cookie[$this->cname]) ? 0 : encrypt(CookiesToStr($this->cookie)));
         if (!empty($this->post)) {
             foreach ($this->post as $k => $v) {
                 $data["T8gXFS[{$k}]"] = $v;
             }
         }
         $data['step'] = $step;
         $data['captcha_type'] = $captcha['type'];
         switch ($captcha['type']) {
             default:
                 return html_error('Unknown captcha type.');
             case 1:
                 list($headers, $imgBody) = explode("\r\n\r\n", $this->GetPage($captcha['url']), 2);
                 if (substr($headers, 9, 3) != '200') {
                     html_error('[1] Error downloading CAPTCHA img.');
                 }
                 $mimetype = preg_match('@image/[\\w+]+@', $headers, $mimetype) ? $mimetype[0] : 'image/jpg';
                 return $this->EnterCaptcha("data:{$mimetype};base64," . base64_encode($imgBody), $data);
             case 2:
                 $_POST['T8gXFS'] = $this->post;
                 $_POST['captcha'] = $captcha['key'];
                 $_POST['step'] = $step;
                 $_POST['captcha_type'] = 2;
                 return true;
             case 3:
                 return $this->reCAPTCHA($captcha['key'], $data);
             case 4:
                 return $this->SolveMedia($captcha['key'], $data);
         }
     }
     return false;
 }
 private function saveCookie()
 {
     if (empty($this->cookie)) {
         return false;
     }
     $filename = DOWNLOAD_DIR . 'billionuploads_com_cookie.php';
     $cookies = is_array($this->cookie) ? CookiesToStr($this->cookie) : $this->cookie;
     file_put_contents($filename, "<?php exit(); ?>\r\n" . base64_encode(encrypt($cookies)), LOCK_EX);
     return true;
 }
예제 #25
0
function upfile($host, $port, $url, $referer, $cookie, $post, $file, $filename, $fieldname, $field2name = '', $proxy = 0, $pauth = 0, $upagent = 0, $scheme = 'http')
{
    global $nn, $lastError, $sleep_time, $sleep_count;
    if (empty($upagent)) {
        $upagent = 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.12';
    }
    $scheme .= '://';
    $bound = '--------' . md5(microtime());
    $saveToFile = 0;
    $postdata = '';
    if ($post) {
        foreach ($post as $key => $value) {
            $postdata .= '--' . $bound . $nn;
            $postdata .= "Content-Disposition: form-data; name=\"{$key}\"{$nn}{$nn}";
            $postdata .= $value . $nn;
        }
    }
    $fileSize = getSize($file);
    $fieldname = $fieldname ? $fieldname : file . md5($filename);
    if (!is_readable($file)) {
        $lastError = sprintf(lang(65), $file);
        return FALSE;
    }
    if ($field2name != '') {
        $postdata .= '--' . $bound . $nn;
        $postdata .= "Content-Disposition: form-data; name=\"{$field2name}\"; filename=\"\"{$nn}";
        $postdata .= "Content-Type: application/octet-stream{$nn}{$nn}";
    }
    $postdata .= '--' . $bound . $nn;
    $postdata .= "Content-Disposition: form-data; name=\"{$fieldname}\"; filename=\"{$filename}\"{$nn}";
    $postdata .= "Content-Type: application/octet-stream{$nn}{$nn}";
    $cookies = '';
    if (!empty($cookie)) {
        if (is_array($cookie)) {
            if (count($cookie) > 0) {
                $cookies = 'Cookie: ' . CookiesToStr($cookie) . $nn;
            }
        } else {
            $cookies = 'Cookie: ' . trim($cookie) . $nn;
        }
    }
    $referer = $referer ? "Referer: {$referer}{$nn}" : '';
    if ($scheme == 'https://') {
        $scheme = 'ssl://';
        $port = 443;
    }
    if ($proxy) {
        list($proxyHost, $proxyPort) = explode(':', $proxy, 2);
        $host = $host . ($port != 80 && ($scheme != 'ssl://' || $port != 443) ? ':' . $port : '');
        $url = $scheme . $host . $url;
    }
    if ($scheme != 'ssl://') {
        $scheme = '';
    }
    $http_auth = !empty($auth) ? "Authorization: Basic {$auth}{$nn}" : '';
    $proxyauth = !empty($pauth) ? "Proxy-Authorization: Basic {$pauth}{$nn}" : '';
    $zapros = 'POST ' . str_replace(' ', "%20", $url) . ' HTTP/1.0' . $nn . 'Host: ' . $host . $nn . $cookies . "Content-Type: multipart/form-data; boundary=" . $bound . $nn . "Content-Length: " . (strlen($postdata) + strlen($nn . "--" . $bound . "--" . $nn) + $fileSize) . $nn . "User-Agent: " . $upagent . $nn . "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" . $nn . "Accept-Language: en-en,en;q=0.5" . $nn . "Accept-Charset: utf-8,windows-1251;koi8-r;q=0.7,*;q=0.7" . $nn . "Connection: Close" . $nn . $http_auth . $proxyauth . $referer . $nn . $postdata;
    $errno = 0;
    $errstr = '';
    $posturl = (!empty($proxyHost) ? $scheme . $proxyHost : $scheme . $host) . ':' . (!empty($proxyPort) ? $proxyPort : $port);
    $fp = @stream_socket_client($posturl, $errno, $errstr, 120, STREAM_CLIENT_CONNECT);
    //$fp = @fsockopen ( $host, $port, $errno, $errstr, 150 );
    //stream_set_timeout ( $fp, 300 );
    if (!$fp) {
        $dis_host = !empty($proxyHost) ? $proxyHost : $host;
        $dis_port = !empty($proxyPort) ? $proxyPort : $port;
        html_error(sprintf(lang(88), $dis_host, $dis_port));
    }
    if ($errno || $errstr) {
        $lastError = $errstr;
        return false;
    }
    if ($proxy) {
        echo '<p>' . sprintf(lang(89), $proxyHost, $proxyPort) . '<br />';
        echo "UPLOAD: <b>{$url}</b>...<br />\n";
    } else {
        echo '<p>';
        printf(lang(90), $host, $port);
        echo '</p>';
    }
    echo lang(104) . ' <b>' . $filename . '</b>, ' . lang(56) . ' <b>' . bytesToKbOrMbOrGb($fileSize) . '</b>...<br />';
    global $id;
    $id = md5(time() * rand(0, 10));
    require TEMPLATE_DIR . '/uploadui.php';
    flush();
    $timeStart = getmicrotime();
    //$chunkSize = 16384;		// Use this value no matter what (using this actually just causes massive cpu usage for large files, too much data is flushed to the browser!)
    $chunkSize = GetChunkSize($fileSize);
    fputs($fp, $zapros);
    fflush($fp);
    $fs = fopen($file, 'r');
    $local_sleep = $sleep_count;
    //echo('<script type="text/javascript">');
    $totalsend = $time = $lastChunkTime = 0;
    while (!feof($fs) && !$errno && !$errstr) {
        $data = fread($fs, $chunkSize);
        if ($data === false) {
            fclose($fs);
            fclose($fp);
            html_error(lang(112));
        }
        if ($sleep_count !== false && $sleep_time !== false && is_numeric($sleep_time) && is_numeric($sleep_count) && $sleep_count > 0 && $sleep_time > 0) {
            $local_sleep--;
            if ($local_sleep == 0) {
                usleep($sleep_time);
                $local_sleep = $sleep_count;
            }
        }
        $sendbyte = @fputs($fp, $data);
        fflush($fp);
        if ($sendbyte === false || strlen($data) > $sendbyte) {
            fclose($fs);
            fclose($fp);
            html_error(lang(113));
        }
        $totalsend += $sendbyte;
        $time = getmicrotime() - $timeStart;
        $chunkTime = $time - $lastChunkTime;
        $chunkTime = $chunkTime ? $chunkTime : 1;
        $lastChunkTime = $time;
        $speed = round($sendbyte / 1024 / $chunkTime, 2);
        $percent = round($totalsend / $fileSize * 100, 2);
        echo '<script type="text/javascript">pr(' . "'" . $percent . "', '" . bytesToKbOrMbOrGb($totalsend) . "', '" . $speed . "');</script>\n";
        flush();
    }
    //echo('</script>');
    if ($errno || $errstr) {
        $lastError = $errstr;
        return false;
    }
    fclose($fs);
    fputs($fp, $nn . "--" . $bound . "--" . $nn);
    fflush($fp);
    $page = '';
    while (!feof($fp)) {
        $data = fgets($fp, 16384);
        if ($data === false) {
            break;
        }
        $page .= $data;
    }
    fclose($fp);
    return $page;
}
예제 #26
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->Show_reCaptcha($cpid[1], $data);
         exit;
     }
 }
예제 #27
0
 private function Premium($password = false)
 {
     $post_url = "http://uploading.com/files/get/?ajax";
     if ($password == true) {
         $post = array();
         $post['action'] = $_POST['action'];
         $post['code'] = $_POST['code'];
         $post['pass'] = $_POST['password'];
         $this->cookie = decrypt(urldecode($_POST['cookie']));
         $page = $this->GetPage($post_url, $this->cookie, $post, $this->link . "\r\nX-Requested-With: XMLHttpRequest");
     } else {
         $this->page = $this->GetPage($this->link, $this->cookie, 0, $this->link);
         is_present($this->page, 'Your account premium traffic has been limited');
         if (preg_match('@https?://([^/\\r\\n\\"\'<>\\s\\t]+\\.)?uploading\\.com/get_file/[^\\r\\n\\"\'<>\\s\\t]+@i', $this->page, $dl)) {
             //this for direct link file
             $this->RedirectDownload($dl[0], 'UP_premium', $this->cookie, 0, $this->link);
             return;
             // T8: return is better :D
         } else {
             if (!preg_match('@code: "([^"]+)",@', $this->page, $cd)) {
                 html_error("Error: Link id not found.");
             }
             if (stripos($this->page, 'data-pass="******"') !== false) {
                 $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
                 $data['action'] = 'get_link';
                 $data['code'] = $cd[1];
                 $data['step'] = 'passpre';
                 $this->EnterPassword($data);
                 exit;
             } else {
                 // no password
                 $post['action'] = 'get_link';
                 $post['code'] = $cd[1];
                 $post['pass'] = '******';
                 $page = $this->GetPage($post_url, $this->cookie, $post, $this->link . "\r\nX-Requested-With: XMLHttpRequest");
             }
         }
     }
     $json = $this->Get_Reply($page);
     if (!empty($json['error'])) {
         html_error('Error at download: ' . $json['error']);
     }
     if (!preg_match('@https?://([^/\\r\\n\\"\'<>\\s\\t]+\\.)?uploading\\.com/get_file/[^\\r\\n\\"\'<>\\s\\t]+@i', $json['answer']['link'], $dl)) {
         $page = $this->GetPage($json['answer']['link'], $this->cookie);
         if (!preg_match('@https?://([^/\\r\\n\\"\'<>\\s\\t]+\\.)?uploading\\.com/get_file/[^\\r\\n\\"\'<>\\s\\t]+@i', $page, $dl)) {
             html_error('Download-link not found.');
         }
     }
     //$filename = basename(parse_url($json['answer']['link'], PHP_URL_PATH));
     $this->RedirectDownload($dl[0], 'UP_premium', $this->cookie);
 }
예제 #28
0
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;
    }
}
 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);
     }
 }
 private function Login()
 {
     global $premium_acc;
     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'] : $premium_acc['rapidgator_net']['user'];
     $pass = $pA ? $_REQUEST['premium_pass'] : $premium_acc['rapidgator_net']['pass'];
     if (empty($user) || empty($pass)) {
         html_error('Login Failed: User or Password is empty. Please check login data.', 0);
     }
     $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/';
     $page = $this->GetPage($purl . 'auth/login', $this->cookie, $post, $purl);
     $this->cookie = GetCookiesArr($page, $this->cookie);
     // There are more of those redirects at login
     $rdc = 0;
     $redir = $purl . 'auth/login';
     while (($redir = $this->ChkRGRedirs($page, parse_url($redir), '/auth/login')) && $rdc < 5) {
         $page = $this->GetPage($redir, $this->cookie, $post, $purl);
         $this->cookie = GetCookiesArr($page, $this->cookie);
         $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.');
     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 = $this->GetPage($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 = $this->GetPage($purl, $this->cookie, 0, $purl . 'auth/login');
     is_present($page, '>Free</a>', 'Account isn\'t premium');
     $this->PremiumDL();
 }