Advertisement
Th3-822

[rapidleech][u] 4shared.com_member.php

Apr 9th, 2013
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.51 KB | None | 0 0
  1. <?php
  2. ######## Account Info ########
  3. $upload_acc['4shared_com']['user'] = ''; //Set your login
  4. $upload_acc['4shared_com']['pass'] = ''; //Set your password
  5. ########################
  6.  
  7. $_GET['proxy'] = isset($_GET['proxy']) ? $_GET['proxy'] : '';
  8. $not_done = true;
  9.  
  10. // Check https support for requests.
  11. $use_curl = $options['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false;
  12. $chttps = false;
  13. $use_https = true;
  14. if ($use_curl) {
  15.     $cV = curl_version();
  16.     if (in_array('https', $cV['protocols'], true)) $chttps = true;
  17. }
  18. if (!extension_loaded('openssl') && !$chttps) $use_https = false;
  19. else if (!$chttps) $use_curl = false;
  20.  
  21. if ($upload_acc['4shared_com']['user'] && $upload_acc['4shared_com']['pass']) {
  22.     $default_acc = true;
  23.     $_REQUEST['up_login'] = $upload_acc['4shared_com']['user'];
  24.     $_REQUEST['up_pass'] = $upload_acc['4shared_com']['pass'];
  25.     $_REQUEST['action'] = 'FORM';
  26.     echo "<b><center>Using Default Login.</center></b>\n";
  27. } else $default_acc = false;
  28.  
  29. if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'FORM') {
  30.     echo "<table border='0' style='width:270px;' cellspacing='0' align='center'>
  31.     <form method='POST'>
  32.     <input type='hidden' name='action' value='FORM' />
  33.     <tr><td style='white-space:nowrap;'>&nbsp;Login*</td><td>&nbsp;<input type='text' name='up_login' value='' style='width:160px;' /></td></tr>
  34.     <tr><td style='white-space:nowrap;'>&nbsp;Password*</td><td>&nbsp;<input type='password' name='up_pass' value='' style='width:160px;' /></td></tr>\n";
  35.     echo "<tr><td colspan='2' align='center'><br /><input type='submit' value='Upload' /></td></tr>\n";
  36.     echo "<tr><td colspan='2' align='center'><small>*You can set it as default in <b>".basename(__FILE__)."</b></small></td></tr>\n";
  37.     echo "</table>\n</form>\n";
  38. } else {
  39.     $login = $not_done = false;
  40.     $domain = 'www.4shared.com';
  41.     $referer = "https://$domain/";
  42.  
  43.     $home_url = $referer . 'account/home.jsp';
  44.  
  45.     // Login
  46.     echo "<table style='width:600px;margin:auto;'>\n<tr><td align='center'>\n<div id='login' width='100%' align='center'>Login to $domain</div>\n";
  47.  
  48.     $cookie = array('4langcookie' => 'en');
  49.     if (!empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) {
  50.         if (!empty($_REQUEST['A_encrypted'])) {
  51.             $_REQUEST['up_login'] = decrypt(urldecode($_REQUEST['up_login']));
  52.             $_REQUEST['up_pass'] = decrypt(urldecode($_REQUEST['up_pass']));
  53.             unset($_REQUEST['A_encrypted']);
  54.         }
  55.  
  56.         $post = array();
  57.         $post['login'] = urlencode($_REQUEST['up_login']);
  58.         $post['password'] = urlencode($_REQUEST['up_pass']);
  59.         $post['returnto'] = urlencode($home_url);
  60.         $post['_remember'] = $post['remember'] = 'on';
  61.  
  62.         $page = ul_GetPage($referer . 'web/login', $cookie, $post, $referer);
  63.         is_present($page, 'Invalid e-mail address or password', 'Login Failed: Email/Password incorrect.');
  64.  
  65.         $cookie = GetCookiesArr($page, $cookie);
  66.         if (empty($cookie['Login']) || empty($cookie['Password'])) html_error('Login Error.');
  67.  
  68.         $login = true;
  69.     } else {
  70.         html_error('Login Failed: Login/Password empty.');
  71.     }
  72.  
  73.     // Retrive upload ID
  74.     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";
  75.  
  76.     $page = ul_GetPage($referer . 'account/home.jsp', $cookie, 0, $referer);
  77.     $cookie = GetCookiesArr($page, $cookie);
  78.  
  79.     if (!preg_match('@dc_path\s*:\s*[\'\"](https?://dc\d+\.4shared\.com)[\'\"]@i', $page, $up_server)) html_error('Upload Server Not Found.');
  80.     $up_server = $up_server[1];
  81.     if (!preg_match('@(?:id="jsRootFolderIdForCurrentUser"|class="jsRootId") value="([\w\-\.]+)"@i', $page, $folder_id)) html_error('Root Folder ID Not Found.');
  82.     $folder_id = urlencode($folder_id[1]);
  83.  
  84.     $up_url = "$up_server/main/upload.jsp?x-upload-dir=$folder_id";
  85.  
  86.     // Uploading
  87.     echo "<script type='text/javascript'>document.getElementById('info').style.display='none';</script>\n";
  88.     $url = parse_url($up_url);
  89.     $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']);
  90.  
  91.     // Upload Finished
  92.     echo "<script type='text/javascript'>document.getElementById('progressblock').style.display='none';</script>\n";
  93.  
  94.     is_page($upfiles);
  95.  
  96.     if (!preg_match('@https?://(?:www\.)?4shared\.com/\w+/[\w\-\.]+/[^\r\n\"\'<>]+\.html?@i', $upfiles, $download_link)) {
  97.         if (preg_match('@id="alert"\s+value=\"([^\"\r\n<>]+)\"@i', $upfiles, $err)) html_error('Upload Error: ' . htmlspecialchars($err[1]));
  98.         is_notpresent($upfiles, 'Your upload has successfully completed!', 'Upload Failed.');
  99.         html_error('Download-Link not Found.');
  100.     }
  101.  
  102.     $download_link = $download_link[0];
  103. }
  104.  
  105. function ul_GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0) {
  106.     if (!$referer && !empty($GLOBALS['Referer'])) {
  107.         $referer = $GLOBALS['Referer'];
  108.     }
  109.  
  110.     if ($GLOBALS['use_curl']) {
  111.         if ($XMLRequest) $referer .= "\r\nX-Requested-With: XMLHttpRequest";
  112.         $page = cURL($link, $cookie, $post, $referer, $auth);
  113.     } else {
  114.         global $pauth;
  115.         $Url = parse_url($link);
  116.         $page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest);
  117.         is_page($page);
  118.     }
  119.     return $page;
  120. }
  121.  
  122. //[11-11-2015] ReWritten by Th3-822.
  123. //[13-11-2015] Fixed Link Regexp. - Th3-822
  124.  
  125. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement