PageRenderTime 62ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/hosts/upload/filepost.com_member.php

https://gitlab.com/dkiller1/rapidleech
PHP | 112 lines | 77 code | 23 blank | 12 comment | 23 complexity | 00094c266b1c85451efe89b3dc4ce1a9 MD5 | raw file
  1. <?php
  2. ####### Account Info. ###########
  3. $upload_acc['filepost_com']['user'] = ""; //Set your email
  4. $upload_acc['filepost_com']['pass'] = ""; //Set your password
  5. ##############################
  6. $not_done = true;
  7. $continue_up = false;
  8. if ($upload_acc['filepost_com']['user'] && $upload_acc['filepost_com']['pass']) {
  9. $_REQUEST['up_login'] = $upload_acc['filepost_com']['user'];
  10. $_REQUEST['up_pass'] = $upload_acc['filepost_com']['pass'];
  11. $_REQUEST['action'] = "FORM";
  12. echo "<p style='text-align:center;font-weight:bold;'>Using Default Login and Pass.</p>\n";
  13. }
  14. if ($_REQUEST['action'] == "FORM") $continue_up=true;
  15. else {
  16. echo "<table border='0' style='width:270px;' cellspacing='0' align='center'>
  17. <form method='POST'>
  18. <input type='hidden' name='action' value='FORM' />
  19. <tr><td style='white-space:nowrap;'>&nbsp;Email*</td><td>&nbsp;<input type='text' name='up_login' value='' style='width:160px;' /></td></tr>
  20. <tr><td style='white-space:nowrap;'>&nbsp;Password*</td><td>&nbsp;<input type='password' name='up_pass' value='' style='width:160px;' /></td></tr>\n";
  21. echo "\t<tr><td colspan='2' align='center'><br /><input type='submit' value='Upload' /></td></tr>
  22. <tr><td colspan='2' align='center'><small>*You can set it as default in <b>{$page_upload["filepost.com_member"]}</b></small></td></tr>\n</table>\n</form>\n";
  23. }
  24. if ($continue_up) {
  25. $not_done = $login = false;
  26. $cookie = array();
  27. // Login
  28. echo "<table style='width:600px;margin:auto;'>\n<tr><td align='center'>\n<div id='login' width='100%' align='center'>Login to Filepost</div>\n";
  29. if (!empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) {
  30. $post = array();
  31. $post["email"] = urlencode($_REQUEST['up_login']);
  32. $post["password"] = urlencode($_REQUEST['up_pass']);
  33. $page = geturl ('filepost.com', 80, '/general/login_form/?JsHttpRequest='.time().'-xml', 'http://filepost.com/', 0, $post);
  34. is_page($page);
  35. is_present($page, 'Incorrect e-mail\/password combination', 'Login Failed: Invalid username and/or password.');
  36. $cookie = GetCookiesArr($page);
  37. if (empty($cookie['SID'])) html_error('Login Failed: Session cookie not found');
  38. $login = true;
  39. } else echo "<b><center>Login not found or empty, using non member upload.</center></b>\n";
  40. // Retrive upload ID
  41. echo "<script type='text/javascript'>document.getElementById('login').style.display='none';</script>\n<div id='info' width='100%' align='center'>Retrive upload ID</div>\n";
  42. // Start loop here
  43. $try = 0;
  44. $max_trys = 4;
  45. do {
  46. $try++;
  47. $page = geturl("filepost.com", 80, "/", 0, $cookie);is_page($page);
  48. if ($try > $max_trys) {
  49. $try = $try-1;
  50. if (stristr($page, 'Upload will be available a bit later')) html_error("Error@$try: Upload will be available a bit later.");
  51. else html_error("Error: No useable upload server found in $try trys.");
  52. }
  53. $cookie = array_merge($cookie, GetCookiesArr($page));
  54. if (stristr($page, 'Upload will be available a bit later')) {
  55. sleep(1); // Let's wait...
  56. continue;
  57. }
  58. if (!preg_match("@upload_url:\s+'(http://fs\d+\.filepost\.com/)([^\']+)'@i", $page, $loc)) html_error("Upload url not found.");
  59. //Testing server.
  60. $test = @file_get_contents($loc[1].'crossdomain.xml');
  61. if ($try+1 == $max_trys && !$test) { // To be removed later...
  62. //Do code at last try
  63. // With my acc logged in, selected server doesn't connect... But without it work...
  64. $loc[1] = 'http://fs470.filepost.com/'; //I will use one of the working servers
  65. $test = file_get_contents($loc[1].'crossdomain.xml');
  66. }
  67. } while (!$test);
  68. // Now we have a useable upload server...
  69. $post = array();
  70. $post['Filename'] = $lname;
  71. $post['SID'] = cut_str($page, "SID: '", "'");
  72. $post['Upload'] = 'Submit Query';
  73. $up_loc = $loc[1].$loc[2];
  74. // Uploading
  75. echo "<script type='text/javascript'>document.getElementById('info').style.display='none';</script>\n";
  76. $url = parse_url($up_loc);
  77. $upfiles = upfile($url["host"],$url["port"] ? $url["port"] : 80, $url["path"].($url["query"] ? "?".$url["query"] : ""), '', 0, $post, $lfile, $lname, "file", '', 0, 0, 'Shockwave Flash');
  78. // Upload Finished
  79. echo "<script type='text/javascript'>document.getElementById('progressblock').style.display='none';</script>";
  80. is_page($upfiles);
  81. if (!preg_match('@\{"answer":"(\w+)"\}@i', $upfiles, $udid)) html_error("File-Adm id not found.");
  82. $page = geturl("filepost.com", 80, "/files/done/".$udid[1], 'http://filepost.com/', $cookie);is_page($page);
  83. if (preg_match('@id="down_link"[^<|>]+value="(http://[^\"]+)"@i', $page, $dl)) {
  84. $download_link = $dl[1];
  85. if (preg_match('@id="edit_link"[^<|>]+value="(http://[^\"]+)"@i', $page, $adml)) $adm_link = $adml[1];
  86. } else html_error("Download link not found.");
  87. }
  88. //[07-12-2011] Written by Th3-822.
  89. ?>