PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/hosts/download/filefat_com.php

http://rapidleech.googlecode.com/
PHP | 129 lines | 114 code | 11 blank | 4 comment | 17 complexity | 8acb30562aa63c9dc509d3e1cf5d170c MD5 | raw file
  1. <?php
  2. if (!defined('RAPIDLEECH')) {
  3. require_once ("index.html");
  4. exit ();
  5. }
  6. class filefat_com extends DownloadClass {
  7. public function Download($link) {
  8. global $premium_acc;
  9. if ($_REQUEST['premium_acc'] == 'on' && (($_REQUEST['premium_user'] && $_REQUEST['premium_pass']) || ($premium_acc['filefat_com']['user'] && $premium_acc['filefat_com']['pass']))) {
  10. $this->Premium($link);
  11. } elseif ($_POST['step'] == '1') {
  12. $this->Free($link);
  13. } else {
  14. $this->Retrieve($link);
  15. }
  16. }
  17. private function Retrieve($link) {
  18. $page = $this->GetPage($link);
  19. is_present($page, "The file you were looking for could not be found", "File Not Found");
  20. $id = cut_str($page, 'name="id" value="','"');
  21. $FileName = cut_str($page, 'name="fname" value="','"');
  22. $post = array();
  23. $post['op'] = "download1";
  24. $post['usr_login'] = "";
  25. $post['id'] = $id;
  26. $post['fname'] = $FileName;
  27. $post['referer'] = $link;
  28. $post['method_free'] = "SLOW DOWNLOAD";
  29. $page = $this->GetPage($link, 0, $post, $link);
  30. $rand = cut_str($page, 'name="rand" value="','"');
  31. if (preg_match("#You have to wait (\d+) minutes, (\d+) seconds till next download#",$page,$message)){
  32. html_error($message[0]);
  33. }
  34. if (preg_match('#(\d+)</span> seconds#', $page, $wait)) {
  35. $this->CountDown($wait[1]);
  36. }
  37. $k = cut_str($page, 'api/challenge?k=', '"');
  38. $page = $this->GetPage("http://www.google.com/recaptcha/api/challenge?k=".$k);
  39. $ch = cut_str($page, "challenge : '", "'");
  40. $img = "http://www.google.com/recaptcha/api/image?c=".$ch;
  41. $page = $this->GetPage($img);
  42. $capt_img = substr($page, strpos($page, "\r\n\r\n") + 4);
  43. $imgfile = DOWNLOAD_DIR."filefat.jpg";
  44. if (file_exists($imgfile)) {
  45. unlink($imgfile);
  46. }
  47. write_file($imgfile, $capt_img);
  48. $data = $this->DefaultParamArr($link, 0, $link);
  49. $data['step'] = "1";
  50. $data['fname'] = $FileName;
  51. $data['id'] = $id;
  52. $data['rand'] = $rand;
  53. $data['recaptcha_challenge_field'] = $ch;
  54. $this->EnterCaptcha($imgfile, $data, 20);
  55. exit();
  56. }
  57. private function Free($link) {
  58. $post = array();
  59. $post['op'] = "download2";
  60. $post['id'] = $_POST['id'];
  61. $post['rand'] = $_POST['rand'];
  62. $post['referer'] = urldecode($_POST['referer']);
  63. $post['method_free'] = "SLOW DOWNLOAD";
  64. $post['method_premium'] = "";
  65. $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
  66. $post['recaptcha_response_field'] = $_POST['captcha'];
  67. $post['down_script'] = "1";
  68. $FileName = $_POST['fname'];
  69. $page = $this->GetPage($link, 0, $post, $link);
  70. if (strpos($page, "Wrong captcha")) {
  71. return $this->Retrieve($link);
  72. }
  73. if (!stristr($page, 'Location:')) {
  74. html_error("Error, Download link not found!");
  75. }
  76. $dlink = trim(cut_str( $page, "Location: ", "\n" ));
  77. $Url = parse_url($dlink);
  78. if (!$FileName) $FileName = basename($Url['path']);
  79. $this->RedirectDownload($dlink, $FileName, 0, 0, $link);
  80. exit();
  81. }
  82. private function Premium($link) {
  83. global $premium_acc, $Referer;
  84. $post = array();
  85. $post['op'] = "login";
  86. $post['redirect'] = urlencode('http://http://filefat.com/');
  87. $post['login'] = $_REQUEST["premium_user"] ? trim($_REQUEST["premium_user"]) : $premium_acc ["filefat_com"] ["user"];
  88. $post['password'] = $_REQUEST["premium_pass"] ? trim($_REQUEST["premium_pass"]) : $premium_acc ["filefat_com"] ["pass"];
  89. $post['x'] = rand(0,88);
  90. $post['y'] = rand(0,16);
  91. $page = $this->GetPage('http://www.filefat.com/login.html', 0, $post, 'http://www.filefat.com/');
  92. is_present($page, 'Incorrect', 'Incorrect Login or Password');
  93. $cookie = GetCookies($page);
  94. $page = $this->GetPage($link, $cookie);
  95. is_present($page, 'The file you were looking for could not be found', 'File not found');
  96. unset($post);
  97. $post['op'] = "download2";
  98. $post['id'] = cut_str($page, 'name="id" value="','"');
  99. $post['rand'] = cut_str($page, 'name="rand" value="','"');
  100. $post['referer'] = $link;
  101. $post['method_free'] = "";
  102. $post['method_premium'] = "1";
  103. $post['down_direct'] = "1";
  104. $page = $this->GetPage($link, $cookie, $post, $link);
  105. if (!preg_match('/http:\/\/livia\.castlegem\.co\.uk\/files\/[0-9]\/[^\"]+/', $page, $dl)) {
  106. html_error('Error: Download link not found!');
  107. }
  108. $Url = parse_url($dl[0]);
  109. $FileName = basename($Url['path']);
  110. $this->RedirectDownload($dl[0], $FileName, $cookie, 0, $link);
  111. exit();
  112. }
  113. }
  114. /*
  115. * Filefat free download plugin by Ruud v.Tony 25-07-2011
  116. * Updated to support premium 09-08-2011
  117. */
  118. ?>