Advertisement
Guest User

Untitled

a guest
Apr 26th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.43 KB | None | 0 0
  1. <?php
  2. $arrayz = array();
  3. $mysqli = new mysqli("asdsadsad", "addsasdasda", "dsdsadsdsaasd", "adsdsasadasdasd");
  4. if ($mysqli->connect_errno) {
  5. printf("Connect failed: %s\n", $mysqli->connect_error);
  6. exit();
  7. }
  8. $query = "SELECT username,user_id FROM `xf_user` WHERE `avatar_date` !=0 LIMIT 1,10";
  9. if ($result = $mysqli->query($query)) {
  10. while ($row = $result->fetch_assoc()) {
  11. // echo $row["username"]." ".$row["user_id"]."</br>";
  12. // echo ' ';
  13. //array_push($array, $row["username"];
  14. $player = strtolower($row["username"]);
  15. $user_id = strtolower($row["user_id"]);
  16. //array_push($array,"$player" => "$user_id");
  17. $arrayz[$user_id] = "$player,$user_id";
  18.  
  19. }
  20. //mysqli_close($link);
  21. foreach ($arrayz as &$value) {
  22. echo $value;
  23. // echo key($value);
  24. $user = explode(",", $value);
  25. $user_id = $user[1];
  26. $player = $user[0];
  27.  
  28.  
  29.  
  30. $username = "$bot";
  31. $password = "$passwordBot";
  32. $url = "http://minepocket.com/login/login";
  33.  
  34. $curl_handle = curl_init($url);
  35. curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  36. curl_setopt($curl_handle, CURLOPT_COOKIEJAR, 'cookie.txt');
  37. curl_setopt($curl_handle, CURLOPT_COOKIEFILE, 'cookie.txt');
  38.  
  39. curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
  40. curl_setopt($ch, CURLOPT_HEADER, 1);
  41. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0");
  42. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  43. $post_array = array(
  44. 'login' => $username,
  45. 'password' => $password,
  46. 'cookie_check' => 1,
  47. 'redirect' => 'http://minepocket.com',
  48. 'register' => 0,
  49. 'remember' => 1
  50. );
  51. curl_setopt($curl_handle, CURLOPT_POSTFIELDS, http_build_query($post_array));
  52. $output = curl_exec($curl_handle);
  53.  
  54. //Now logged in
  55. $curl_handle = curl_init('http://minepocket.com/members/' . $player . '.' . $user_id . '/');
  56. curl_setopt($ch, CURLOPT_COOKIESESSION, true);
  57. curl_setopt($curl_handle, CURLOPT_COOKIEJAR, 'cookie.txt');
  58. curl_setopt($curl_handle, CURLOPT_COOKIEFILE, 'cookie.txt');
  59. curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
  60. $output = curl_exec($curl_handle);
  61. curl_close($ch);
  62. //echo $output;
  63.  
  64.  
  65. $file = 'website.html';
  66. file_put_contents($file, $output);
  67.  
  68. $searchfor = 'http://minepocket.com/data/avatars';
  69.  
  70.  
  71. $contents = file_get_contents($file);
  72. // escape special characters in the query
  73. $pattern = preg_quote($searchfor, '/');
  74. // finalise the regular expression, matching the whole line
  75. $pattern = "/^.*$pattern.*\$/m";
  76. // search, and store all matching occurences in $matches
  77.  
  78. if (preg_match_all($pattern, $contents, $matches)) {
  79.  
  80. $avatar = $matches[0][0];
  81. $avatar = explode('"', $matches[0][0]);
  82. $img = $avatar[1];
  83. function get_http_response_code($img)
  84. {
  85. $headers = get_headers($img);
  86. return substr($headers[0], 9, 3);
  87.  
  88.  
  89. }
  90.  
  91.  
  92. if (get_http_response_code("$img") != "200") {
  93. $str = str_replace("http://minepocket.com", "http://pocketminers.com", "$img");
  94. $path = explode("/", $str);
  95. for ($x = 1; $x <= 3; $x++) {
  96. if ($x === 1) {
  97. $path[5] = "l";
  98. define('DIRECTORY', 'data/avatars/l/');
  99.  
  100. }
  101. if ($x === 2) {
  102. $path[5] = "m";
  103.  
  104. define('DIRECTORY', 'data/avatars/m/');
  105. }
  106. if ($x === 3) {
  107. $path[5] = "s";
  108. define('DIRECTORY', 'data/avatars/s/');
  109. }
  110.  
  111. $str = implode("/", $path);
  112. //echo $str;
  113. $avatar = file_get_contents("$str");
  114. ?>
  115. <img src="<?php
  116. echo $str;
  117. ?>">
  118. <?php
  119. $name = explode("?", $path[7]);
  120. header("Content-type: image/jpeg");
  121. $size = str_replace(" ", "", $path[5]);
  122. $file = str_replace(" ", "", $name[0]);
  123.  
  124.  
  125. $directory = "data/avatars/$size/$path[6]/";
  126. if (!is_dir($directory)) {
  127. //file mode
  128. $mode = 0777;
  129. //the third parameter set to true allows the creation of
  130. //nested directories specified in the pathname.
  131. mkdir($directory, $mode, true);
  132. }
  133. file_put_contents("$directory$file", $avatar);
  134.  
  135.  
  136. }
  137. } else {
  138.  
  139. }
  140. }
  141. }
  142. } else {
  143. echo "you failed";
  144. }
  145. mysqli_close($link);
  146.  
  147.  
  148. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement