Пример #1
0
function ApiReq($path, $post = array())
{
    if (!is_array($post)) {
        $post = array();
    }
    if ($path != 'user/login' && !empty($GLOBALS['login_json']['token'])) {
        $post['token'] = $GLOBALS['login_json']['token'];
    }
    $page = ul_GetPage("https://alfafile.net/api/v1/{$path}", 0, array_map('urlencode', $post), 'https://alfafile.net/');
    $reply = json2array($page, "ApiReq({$path}) Error");
    if (empty($reply['response']) && !empty($reply['details'])) {
        html_error("[ApiReq({$path}) Error] " . htmlspecialchars($reply['details'], ENT_QUOTES));
    }
    return $reply['response'];
}
        html_error('Upload URL not found.');
    }
    $up_loc = $ud[0];
    // Uploading
    echo "<script type='text/javascript'>document.getElementById('info').style.display='none';</script>\n";
    $url = parse_url($up_loc);
    $upfiles = upfile($url['host'], defport($url), $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), '', 0, $post, $lfile, $lname, 'file', '', $_GET['proxy'], $pauth, 'Shockwave Flash');
    // Upload Finished
    echo "<script type='text/javascript'>document.getElementById('progressblock').style.display='none';</script>\n";
    is_page($upfiles);
    is_present($upfiles, 'fupaup=1', 'The filename you have provided is against our AUP and may not be uploaded.');
    $body = trim(substr($upfiles, strpos($upfiles, "\r\n\r\n") + 4));
    if (!preg_match('@^\\d+@i', $body, $fid)) {
        html_error("Post-ul fileid not found.");
    }
    $page = ul_GetPage($referer . 'upostproc.php?fid=' . $fid[0], $cookie, 0, $referer);
    if (!preg_match('@https?://(?:[\\w\\-]+\\.)*megashares\\.com/dl/\\w+/[^\\t\\r\\n\'\\"<>]+@i', $page, $dl)) {
        html_error('Download link not found.');
    }
    $download_link = $dl[0];
    if (preg_match('@https?://(?:[\\w\\-]+\\.)*megashares\\.com/\\?dl=\\w+@i', $page, $dlt)) {
        $delete_link = $dlt[0];
    }
}
function ul_GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0)
{
    if (!$referer && !empty($GLOBALS['Referer'])) {
        $referer = $GLOBALS['Referer'];
    }
    if ($GLOBALS['use_curl']) {
        if ($XMLRequest) {
Пример #3
0
function ias3Request($path = '', $header = array())
{
    if (!is_array($header)) {
        $header = array();
    }
    if (!empty($header)) {
        $header = array_map('iaS3HeaderEncode', $header);
    }
    $header['Authorization'] = 'LOW ' . $GLOBALS['iaS3AccessKey'] . ':' . $GLOBALS['iaS3SecretKey'];
    $headers = '';
    foreach ($header as $tok => $val) {
        $headers .= "\r\n{$tok}: {$val}";
    }
    $count = 0;
    $host = 's3.us.archive.org';
    do {
        $page = ul_GetPage(($GLOBALS['use_https'] ? 'https' : 'http') . "://{$host}/{$path}", 0, 0, $GLOBALS['referer'] . $headers);
        $status = intval(substr($page, 9, 3));
        if ($status == 307) {
            if ($count >= 2) {
                html_error('Redirect Loop Detected.');
            }
            if (!preg_match('@(?:\\nLocation: https?://|<Endpoint>)((?:[\\w\\-]+\\.)*archive.org)@i', $page, $host)) {
                html_error('Redirect endpoint not found.');
            }
            $host = $host[1];
        }
    } while ($count++ < 2 && $status == 307);
    return $page;
}
Пример #4
0
     $post['password'] = urlencode($_REQUEST['up_pass']);
     $post['returnto'] = urlencode($home_url);
     $post['_remember'] = $post['remember'] = 'on';
     $page = ul_GetPage($referer . 'web/login', $cookie, $post, $referer);
     is_present($page, 'Invalid e-mail address or password', 'Login Failed: Email/Password incorrect.');
     $cookie = GetCookiesArr($page, $cookie);
     if (empty($cookie['Login']) || empty($cookie['Password'])) {
         html_error('Login Error.');
     }
     $login = true;
 } else {
     html_error('Login Failed: Login/Password empty.');
 }
 // Retrive upload ID
 echo "<script type='text/javascript'>document.getElementById('login').style.display='none';</script>\n<div id='info' width='100%' align='center'>Retrieving upload ID</div>\n";
 $page = ul_GetPage($referer . 'account/home.jsp', $cookie, 0, $referer);
 $cookie = GetCookiesArr($page, $cookie);
 if (!preg_match('@dc_path\\s*:\\s*[\'\\"](https?://dc\\d+\\.4shared\\.com)[\'\\"]@i', $page, $up_server)) {
     html_error('Upload Server Not Found.');
 }
 $up_server = $up_server[1];
 if (!preg_match('@(?:id="jsRootFolderIdForCurrentUser"|class="jsRootId") value="([\\w\\-\\.]+)"@i', $page, $folder_id)) {
     html_error('Root Folder ID Not Found.');
 }
 $folder_id = urlencode($folder_id[1]);
 $up_url = "{$up_server}/main/upload.jsp?x-upload-dir={$folder_id}";
 // Uploading
 echo "<script type='text/javascript'>document.getElementById('info').style.display='none';</script>\n";
 $url = parse_url($up_url);
 $upfiles = upfile($url['host'], defport($url), $url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''), $referer . 'account/home.jsp', $cookie, array(), $lfile, $lname, 'tfff0', '', $_GET['proxy'], $pauth, 0, $url['scheme']);
 // Upload Finished