| \n Login to $domain \n";
$cookie = array('lang' => 'en');
if (!empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) {
// Decrypt login if it was encrypted
if (!empty($_REQUEST['A_encrypted'])) {
$_REQUEST['up_login'] = decrypt(urldecode($_REQUEST['up_login']));
$_REQUEST['up_pass'] = decrypt(urldecode($_REQUEST['up_pass']));
unset($_REQUEST['A_encrypted']);
}
$post = array();
$post['LoginForm%5Bemail%5D'] = urlencode($_REQUEST['up_login']);
$post['LoginForm%5Bpassword%5D'] = urlencode($_REQUEST['up_pass']);
$post['LoginForm%5BrememberMe%5D'] = 1;
if (!empty($_POST['step']) && $_POST['step'] == '1') {
$_POST['step'] = false;
if (empty($_POST['captcha'])) html_error('You didn\'t enter the image verification code.');
$cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
$post['LoginForm%5BverifyCode%5D'] = urlencode($_POST['captcha']);
}
//Redirects
$rdc = 0;
$page = false; // False value for starting the loop.
$redir = "http://$domain/auth/login";
if (!empty($_POST['referer'])) $referer = $_POST['referer'];
while (($redir = ChkRGRedirs($page, $redir, '(?:/auth/login|/site/ChangeLocation/key/)', $default_acc)) && $rdc < 15) {
$page = cURL($redir, $cookie, $post, $referer);
$cookie = GetCookiesArr($page, $cookie);
$referer = $redir;
$rdc++;
}
is_present($page, 'Wrong e-mail or password.', 'Login Failed: Invalid Email or Password.');
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['LoginForm%5BverifyCode%5D'])) 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.
$captcha = explode("\r\n\r\n", cURL($imgurl, $this->cookie), 2);
if (substr($captcha[0], 9, 3) != '200') html_error('Error downloading captcha img.');
$mimetype = (preg_match('@image/[\w+]+@', $captcha[0], $mimetype) ? $mimetype[0] : 'image/png');
$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("data:$mimetype;base64,".base64_encode($captcha[1]), $data, 5, 'Login');
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__'])) html_error("Login Error: Cannot find 'user__' cookie.");
$cookie['lang'] = 'en';
$login = true;
} else html_error('Login failed: User/Password empty.');
// Retrive upload ID
echo "\nRetrive upload ID \n";
//Redirects
$rdc = 0;
$page = false; // False value for starting the loop.
$redir = "http://$domain/";
while (($redir = ChkRGRedirs($page, $redir)) && $rdc < 15) {
$page = cURL($redir, $cookie, 0, $referer);
$cookie = GetCookiesArr($page, $cookie);
$referer = $redir;
$rdc++;
}
if (!preg_match('@var\s+form_url\s*=\s*"(https?://[^/|\"]+/[^\"]+)"\s*;@i', $page, $form_url) || !preg_match('@var\s+progress_url_web\s*=\s*"(https?://[^/|\"]+/[^\"]+)"\s*;@i', $page, $prog_url)) {
is_present($page, 'Your storage space is full. Delete some files or upgrade to the new', 'Your storage space is full');
html_error('Error: Cannot find upload url.');
}
$starttime = time();
$uuid = '';
$hexchars = str_split('0123456789abcdef');
for ($i = 0; $i < 32; $i++) $uuid .= $hexchars[array_rand($hexchars)];
$up_url = $form_url[1]."$uuid&folder_id=0";
// Uploading
echo "\n";
$url = parse_url($up_url);
$upfiles = upfile($url['host'], defport($url), $url['path'].(!empty($url['query']) ? '?'.$url['query'] : ''), $referer, $cookie, array(), $lfile, $lname, 'file', '', $_GET['proxy'], $pauth, 0, $url['scheme']);
// Upload Finished
echo "";
is_page($upfiles);
// Pool Upload
echo "Checking Finished Upload : Try 0 \n";
$x = 1;
do {
echo "\n";
sleep($x + 5); // A little wait
//Redirects
$rdc = 0;
$page = false; // False value for starting the loop.
$redir = $prog_url[1]."&data%5B0%5D%5Buuid%5D=$uuid&data%5B0%5D%5Bstart_time%5D=$starttime";
while (($redir = ChkRGRedirs($page, $redir)) && $rdc < 15) {
$page = cURL($redir, $cookie, 0, $referer);
$cookie = GetCookiesArr($page, $cookie);
$referer = $redir;
$rdc++;
}
$resp = json2array($page, "Cannot get upload status $x");
} while ($x++ < 5 && $resp[0]['state'] == 'processing');
if (!empty($resp[0]['download_url'])) {
$download_link = $resp[0]['download_url'];
if (!empty($resp[0]['remove_url'])) $delete_link = $resp[0]['remove_url'];
} else html_error("Download link not found ({$resp[0]['state']}).");
}
function json2array($content, $errorPrefix = 'Error') {
if (!function_exists('json_decode')) html_error('Error: Please enable JSON in php.');
if (empty($content)) return NULL;
$content = ltrim($content);
if (($pos = strpos($content, "\r\n\r\n")) > 0) $content = trim(substr($content, $pos + 4));
$cb_pos = strpos($content, '{');
$sb_pos = strpos($content, '[');
if ($cb_pos === false && $sb_pos === false) html_error("[$errorPrefix]: JSON start braces not found.");
$sb = ($cb_pos === false || $sb_pos < $cb_pos) ? true : false;
$content = substr($content, strpos($content, ($sb ? '[' : '{')));$content = substr($content, 0, strrpos($content, ($sb ? ']' : '}')) + 1);
if (empty($content)) html_error("[$errorPrefix]: No JSON content.");
$rply = json_decode($content, true);
if ($rply === NULL) html_error("[$errorPrefix]: Error reading JSON.");
return $rply;
}
// Edited For upload.php usage.
function EnterCaptcha($captchaImg, $inputs, $captchaSize = '5', $sname = 'Enter Captcha', $iname = 'captcha') {
echo "\n\n |