reporter1

Untitled

Dec 5th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.03 KB | None | 0 0
  1. <?php
  2. if (!isset($_GET["coords"]) || !isset($_GET["size"]) || !isset($_GET["scopeid"]) || !isset($_GET["overlays"]) || !isset($_GET["user"]))
  3.     exit;
  4.  
  5. $c = explode("x", $_GET["coords"]);
  6. $scope_id = mysql_escape_string($_GET["scopeid"]);
  7. $overlays = $_GET["overlays"] | 0;
  8. $user = mysql_escape_string($_GET["user"]);
  9. $xx = mysql_escape_string($c[1]);
  10. $yy = mysql_escape_string($c[2]);
  11. $x = mysql_escape_string($c[1]) * 256;
  12. $y = mysql_escape_string($c[2]) * 256;
  13. $size = $_GET["size"] + 0;
  14.  
  15.  
  16. $servername = "localhost";
  17. $username = "user";
  18. $password = "password";
  19.  
  20. // Create connection
  21. $paela = new mysqli("127.0.0.1", "user", "password", "database");
  22.  
  23. $xmin = $x - 256;
  24. $xmax = $x + 256;
  25. $ymin = $y - 256;
  26. $ymax = $y + 256;
  27.  
  28. if ($scope_id != "00000000-0000-0000-0000-000000000000")
  29.     $res = $paela->query("select * from regions where locX between $xmin and $xmax  and locY between $ymin and $ymax and ScopeID='$scope_id'");
  30. else
  31.     $res = $paela->query("select * from regions where locX between $xmin and $xmax  and locY between $ymin and $ymax");
  32.  
  33. $row = false;
  34. $has_owned_neighbors = false;
  35. $has_managed_neighbors = false;
  36. $has_other_neighbors = false;
  37. $is_owned = false;
  38. while($region = mysqli_fetch_array($res))
  39. {
  40.     if ($region["locX"] == $x && $region["locY"] == $y)
  41.         $row = $region;
  42.     else
  43.     {
  44.         if ($region["owner_uuid"] == $user)
  45.             $has_owned_neighbors = true;
  46.         else
  47.             $has_other_neighbors = true;
  48.     }
  49. }
  50.  
  51. if (!$row)
  52. {
  53.     echo "<span class=\"map-tooltip\">$xx,$yy</span>\n\n";
  54. }
  55. else
  56. {
  57.    echo "<span class=\"map-tooltip\">" . $row["regionName"] . " $xx,$yy</span>\n";
  58.     echo "regionimg.php?size=$size&uuid=" . $row["regionMapTexture"] . "\n";
  59.  
  60.     if ($row["owner_uuid"] == $user)
  61.         $is_owned = true;
  62.  
  63. }
  64.  
  65. $extrastyle = "";
  66.  
  67. #echo "<img class=\"data\" src=\"images/redgrid.png\" width=\"$size\"/>";
  68. if ($row && $size > 64)
  69.     echo "<input class=\"data\" type=\"hidden\" value=\"no\" />";
  70.     echo "<p class=\"data map-regionname $extrastyle\">" . $row["regionName"] . "</p>";
Advertisement
Add Comment
Please, Sign In to add comment