Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $arrayz = array();
- $mysqli = new mysqli("asdsadsad", "addsasdasda", "dsdsadsdsaasd", "adsdsasadasdasd");
- if ($mysqli->connect_errno) {
- printf("Connect failed: %s\n", $mysqli->connect_error);
- exit();
- }
- $query = "SELECT username,user_id FROM `xf_user` WHERE `avatar_date` !=0 LIMIT 1,10";
- if ($result = $mysqli->query($query)) {
- while ($row = $result->fetch_assoc()) {
- // echo $row["username"]." ".$row["user_id"]."</br>";
- // echo ' ';
- //array_push($array, $row["username"];
- $player = strtolower($row["username"]);
- $user_id = strtolower($row["user_id"]);
- //array_push($array,"$player" => "$user_id");
- $arrayz[$user_id] = "$player,$user_id";
- }
- //mysqli_close($link);
- foreach ($arrayz as &$value) {
- echo $value;
- // echo key($value);
- $user = explode(",", $value);
- $user_id = $user[1];
- $player = $user[0];
- $username = "$bot";
- $password = "$passwordBot";
- $url = "http://minepocket.com/login/login";
- $curl_handle = curl_init($url);
- curl_setopt($ch, CURLOPT_COOKIESESSION, true);
- curl_setopt($curl_handle, CURLOPT_COOKIEJAR, 'cookie.txt');
- curl_setopt($curl_handle, CURLOPT_COOKIEFILE, 'cookie.txt');
- curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0");
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- $post_array = array(
- 'login' => $username,
- 'password' => $password,
- 'cookie_check' => 1,
- 'redirect' => 'http://minepocket.com',
- 'register' => 0,
- 'remember' => 1
- );
- curl_setopt($curl_handle, CURLOPT_POSTFIELDS, http_build_query($post_array));
- $output = curl_exec($curl_handle);
- //Now logged in
- $curl_handle = curl_init('http://minepocket.com/members/' . $player . '.' . $user_id . '/');
- curl_setopt($ch, CURLOPT_COOKIESESSION, true);
- curl_setopt($curl_handle, CURLOPT_COOKIEJAR, 'cookie.txt');
- curl_setopt($curl_handle, CURLOPT_COOKIEFILE, 'cookie.txt');
- curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
- $output = curl_exec($curl_handle);
- curl_close($ch);
- //echo $output;
- $file = 'website.html';
- file_put_contents($file, $output);
- $searchfor = 'http://minepocket.com/data/avatars';
- $contents = file_get_contents($file);
- // escape special characters in the query
- $pattern = preg_quote($searchfor, '/');
- // finalise the regular expression, matching the whole line
- $pattern = "/^.*$pattern.*\$/m";
- // search, and store all matching occurences in $matches
- if (preg_match_all($pattern, $contents, $matches)) {
- $avatar = $matches[0][0];
- $avatar = explode('"', $matches[0][0]);
- $img = $avatar[1];
- function get_http_response_code($img)
- {
- $headers = get_headers($img);
- return substr($headers[0], 9, 3);
- }
- if (get_http_response_code("$img") != "200") {
- $str = str_replace("http://minepocket.com", "http://pocketminers.com", "$img");
- $path = explode("/", $str);
- for ($x = 1; $x <= 3; $x++) {
- if ($x === 1) {
- $path[5] = "l";
- define('DIRECTORY', 'data/avatars/l/');
- }
- if ($x === 2) {
- $path[5] = "m";
- define('DIRECTORY', 'data/avatars/m/');
- }
- if ($x === 3) {
- $path[5] = "s";
- define('DIRECTORY', 'data/avatars/s/');
- }
- $str = implode("/", $path);
- //echo $str;
- $avatar = file_get_contents("$str");
- ?>
- <img src="<?php
- echo $str;
- ?>">
- <?php
- $name = explode("?", $path[7]);
- header("Content-type: image/jpeg");
- $size = str_replace(" ", "", $path[5]);
- $file = str_replace(" ", "", $name[0]);
- $directory = "data/avatars/$size/$path[6]/";
- if (!is_dir($directory)) {
- //file mode
- $mode = 0777;
- //the third parameter set to true allows the creation of
- //nested directories specified in the pathname.
- mkdir($directory, $mode, true);
- }
- file_put_contents("$directory$file", $avatar);
- }
- } else {
- }
- }
- }
- } else {
- echo "you failed";
- }
- mysqli_close($link);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement