| \n Login to $domain \n";
$cookie = array('user_lang' => 'en');
if (!empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) {
$post = array('username' => urlencode($_REQUEST['up_login']), 'password' => urlencode($_REQUEST['up_pass']));
$page = geturl($domain, 80, '/api/login', $referer, 0, $post, 0, $_GET['proxy'], $pauth);is_page($page);
$json = Get_Reply($page);
if (empty($json['user'])) {
if (empty($json['error']) || strtolower($json['error']) == 'success') html_error('Login error: UserID value not found.');
html_error('Login error: ' . htmlentities($json['error']) . '.');
}
$user = $json['user'];
$login = true;
} else echo "Retrive upload ID \n";
$page = geturl($domain, 80, '/api/get-fastest-server', $referer, 0, 0, 0, $_GET['proxy'], $pauth);is_page($page);
$json = Get_Reply($page);
if (empty($json['server'])) {
if (empty($json['error']) || strtolower($json['error']) == 'success') html_error('Cannot get upload url.');
html_error('Cannot get upload url: ' . htmlentities($json['error']) . '.');
}
$post = array();
if ($login) $post['user'] = $user;
$i = 1;
foreach (array_keys($sites) as $site) if ((!empty($_POST['UpT8']) && !empty($_POST['UpT8'][$site])) || (empty($_POST['UpT8']) && empty($DontUlTo[$site]))) $post['host' . $i++] = $site;
$up_url = $json['server'];
// Uploading
echo "\n";
$url = parse_url($up_url);
$upfiles = upfile($url['host'], defport($url), $url['path'].(!empty($url['query']) ? '?'.$url['query'] : ''), $referer, 0, $post, $lfile, $lname, 'files[]', '', $_GET['proxy'], $pauth, 0, $url['scheme']);
// Upload Finished
echo "\n";
is_page($upfiles);
$json = Get_Reply($upfiles);
if (empty($json['url'])) {
if (empty($json['error']) || strtolower($json['error']) == 'success') html_error('Upload error.');
html_error('Upload error: ' . htmlentities($json['error']) . '.');
}
$download_link = $json['url'];
}
function Get_Reply($page) {
if (!function_exists('json_decode')) html_error('Error: Please enable JSON in php.');
$body = substr($page, strpos($page, "\r\n\r\n") + 4);
if (empty($body)) html_error('Error reading json (Empty page).');
$body = substr($body, strpos($body, '{'));$body = substr($body, 0, strrpos($body, '}') + 1);
$json = json_decode($body, true);
if (empty($json)) html_error('Error reading json.');
return $json;
}
//[25-1-2013] Written by Th3-822.
//[14-12-2015] Fixed. - Th3-822
//[19-7-2016] Added referer to requests to fix small bug. - Th3-822
?> |