Advertisement
Guest User

Untitled

a guest
Aug 4th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.51 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. $username = "***";
  5. $password = "***";
  6. $hostname = "***";
  7.  
  8. //connection to the database
  9. $dbhandle = mysql_connect($hostname, $username, $password)
  10.  or die("Unable to connect to MySQL");
  11.  
  12.  
  13. //select a database to work with
  14. $selected = mysql_select_db("hw_terranova",$dbhandle)
  15.   or die("Could not select database");
  16.  ?>  
  17.       <script type="text/javascript" src="https://rawgit.com/pyalot/webgl-heatmap/master/webgl-heatmap.js"></script>
  18.    
  19.  
  20.  
  21.   <style type="text/css">
  22.  
  23.  
  24. body {
  25.     background-image: url("http://steffeno.net/terranova/heatmap/terrainmap_2209x1974.jpg");
  26.     background-color: #cccccc;
  27.  background-repeat: no-repeat;
  28.  width: 2209px;
  29.   height: 1974;
  30.  
  31. }
  32.  
  33. canvas {
  34.  width: 1800px;
  35.   height: 1800px;
  36.   margin: 0;
  37.   padding: 0;
  38. position: absolute;
  39.  // background-color: red;
  40. // border: 5px solid blue;
  41. top: 00px;
  42. left: 220px;
  43. opacity: .8;
  44. }
  45.  
  46. div.controls {
  47.   font-weight: bold;
  48.   position: absolute;
  49.   top: 10px;
  50.   left: 10px;
  51. }
  52.  
  53. header .logo a {
  54. background: rgba(0, 0, 0, 0) url("../images/logo.png") no-repeat scroll center center / 97px 84px;
  55. border: medium none;
  56. color: transparent;
  57. display: block;
  58. font: 0px/0 a;
  59. height: 84px;
  60. width: 97px;
  61. margin: 10px;
  62. outline: 0 none;
  63. padding-left: 15px;
  64. text-shadow: none;
  65. transition: all 0.5s ease-in-out 0s;
  66. position: fixed;
  67. z-index: 2; /* Stay on top */
  68.  
  69. }
  70.  
  71.  /* The side navigation menu */
  72. .sidenav {
  73.     height: 100%; /* 100% Full-height */
  74.     width: 0; /* 0 width - change this with JavaScript */
  75.     position: fixed; /* Stay in place */
  76.     z-index: 1; /* Stay on top */
  77.     top: 0;
  78.     left: 0;
  79.     background-color: #111; /* Black*/
  80.     overflow-x: hidden; /* Disable horizontal scroll */
  81.     padding-top: 120px; /* Place content 60px from the top */
  82.     transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */
  83. }
  84.  
  85. /* The navigation menu links */
  86. .sidenav a {
  87.     padding: 8px 8px 8px 20px;
  88.     text-decoration: none;
  89.     font-size: 15px;
  90.     color: #818181;
  91.     display: block;
  92.     transition: 0.3s
  93. }
  94.  
  95. /* When you mouse over the navigation links, change their color */
  96. .sidenav a:hover, .offcanvas a:focus{
  97.     color: #f1f1f1;
  98. }
  99.  
  100. /* Position and style the close button (top right corner) */
  101. .closebtn {
  102.     position: absolute;
  103.     top: 0;
  104.     right: 0px;
  105.     font-size: 26px !important;
  106.     margin-left: 10px;
  107. }
  108.  
  109. /* Style page content - use this if you want to push the page content to the right when you open the side navigation */
  110. #main {
  111.     transition: margin-left .5s;
  112.     padding: 0px;
  113.  
  114. }
  115.  
  116. /* On smaller screens, where height is less than 450px, change the style of the sidenav (less padding and a smaller font size) */
  117. @media screen and (max-height: 450px) {
  118.     .sidenav {padding-top: 15px;}
  119.     .sidenav a {font-size: 18px;}
  120. }
  121. .sidenavtext  {
  122.     padding: 8px 8px 8px 20px;
  123.     text-decoration: none;
  124.     font-size: 15px;
  125.     color: #818181;
  126.     display: block;
  127.     transition: 0.3s
  128. font-weight: normal;
  129.  
  130. }
  131.  
  132.   </style>
  133.  
  134.  
  135.   <title>Terra Nova Tracking (beta)</title>
  136.  
  137.  
  138. </head>
  139.  
  140. <body>
  141.   <canvas width="1800" height="1800"></canvas>
  142.  
  143. <header>
  144.  
  145.     <div class="logo">
  146.         <span onclick="openNav()"> <a href="#">TerraNova</a></span>
  147.     </div>
  148.  
  149. <div id="mySidenav" class="sidenav">
  150.   <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
  151.   <a href="http://steffeno.net/terranova/">Main page</a>
  152.   <a href="http://steamcommunity.com/groups/TERRAN0VA/">Steam Group</a><br />
  153.  
  154. <div class="sidenavtext">
  155. <hr>
  156. Controlpanel<br />
  157.  
  158.  
  159.  
  160. <?php
  161. $result = mysql_query("SELECT * FROM playermovement");  
  162.    
  163.     echo "<select name='id'>";
  164. while ($row = mysql_fetch_array($result)) {
  165.  
  166.  
  167.  
  168.                unset($id, $name);
  169.                $id = $row['id'];
  170.                  $name = $row['name'];
  171.                echo '<option value="'.$id.'">'.$name.'</option>';
  172.  
  173. }
  174.  
  175.     echo "</select>";
  176.   ?>
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  <button type="button" onclick="location.href='../?name=fuckme">Update</button></form><br /><br />
  184.  
  185. Work in Progress.<br />
  186.  
  187.  
  188.  
  189. <div style="position:relative;">
  190. <span style="position:absolute: bottom:0px;">
  191. Created by Sionn
  192. and Ztif
  193. </span>
  194. </div>
  195.  
  196. </div>
  197.  
  198.  
  199.  
  200. </header>
  201. <div id="main">
  202.  
  203.  
  204. <script type='text/javascript'>//<![CDATA[
  205.  
  206. var canvas = document.getElementsByTagName('canvas')[0];
  207. var heatmap = createWebGLHeatmap({
  208.   canvas: canvas,
  209.   intensityToAlpha:true,
  210. // alphaRange:  [0.9, 0.9],
  211. gradientTexture:'skyline-gradient.png',
  212.     width: 1800,
  213.     height: 1800
  214. });
  215.  
  216.  
  217. document.body.appendChild(heatmap.canvas);
  218. canvas.onclick = function() {
  219.   heatmap.clear();
  220. }
  221.  
  222. var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
  223.   window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
  224.  
  225. // IIFE so our variables don't pollute the global scope
  226. (function(){
  227.     var _addPoint = heatmap.addPoint.bind(heatmap),
  228.         _center = {
  229.             x: canvas.width/2,
  230.             y: canvas.height/2
  231.             },
  232.         _scale = {
  233.             w: canvas.width / 8500,
  234.             h: canvas.height / -8500
  235.           };
  236.  
  237.     heatmap.addPoint = function(x, y, size, intensity){
  238.         x = x*_scale.w + _center.x;
  239.         y = y*_scale.h + _center.y;
  240.         console.log("Adding",x,y);
  241.         _addPoint(x, y, size, intensity);
  242.     };
  243. })();
  244.  
  245.  
  246. var update = function() {
  247.  
  248. <?php
  249.  
  250. //execute the SQL query and return records
  251.  
  252. if(isset($_GET['name'])) {
  253.     $name = $_GET['name'];
  254. $result = mysql_query("SELECT `coordinates` FROM `playermovement` WHERE name = '$name'");
  255. } else {
  256.     $test = '*';
  257.  
  258. $result = mysql_query("SELECT coordinates FROM playermovement");
  259. }
  260. /*
  261. while ($row = mysql_fetch_array($result)) {
  262.    echo "ID:".$row{'id'}." Name:".$row{'model'}."Year: ". //display the results
  263.    $row{'year'}."<br>";
  264. }
  265. */
  266.  
  267. //fetch tha data from the database
  268. while ($row = mysql_fetch_array($result)) {
  269.  
  270.     $coords = explode(",", $row["coordinates"]);
  271.  
  272. if (count($coords) == 3) echo "heatmap.addPoint(". trim($coords[0]). ", ". trim($coords[2]) .", 8, 10 / 255); \n" ;
  273.  
  274. }
  275.  
  276. //close the connection
  277. mysql_close($dbhandle);
  278. ?>
  279.  
  280.  
  281. /*
  282. heatmap.addPoint(2941.6, 2192.8, 25, 10 / 255); //Dune City
  283. heatmap.addPoint(-4614.3, 3061.4, 25, 10 / 255); //Alpha Six
  284. heatmap.addPoint(-0, 0, 45, 10 / 255); //Alpha Six
  285.     heatmap.addPoint(2846, 2152, 25, 10 / 255); //Dune City in Unity
  286.     heatmap.addPoint(-635., 2934.7, 15, 10 / 255); //Redville
  287.     heatmap.addPoint(-4614.3, 3061.4, 65, 10 / 255); //Alpha Six
  288.     heatmap.addPoint(2941.6, 2192.8, 25, 10 / 255); //Dune City
  289.     heatmap.addPoint(-3427.9, -1605.9, 15, 10 / 255); //Slime
  290.     heatmap.addPoint(-3428, -3747, 15, 10 / 255); //Icelake
  291. */
  292.   // heatmap.adjustSize(); // can be commented out for statically sized heatmaps, resize clears the map
  293.   heatmap.update(); // adds the buffered points
  294.   heatmap.display(); // adds the buffered points
  295.   heatmap.multiply(0.9995);
  296.    heatmap.blur();
  297.   heatmap.clamp(0.0, 1.0); // depending on usecase you might want to clamp it
  298.   raf(update);
  299. }
  300. update();
  301.  
  302. //]]>
  303.  
  304.  
  305.  
  306. /* Set the width of the side navigation to 250px and the left margin of the page content to 150px */
  307. function openNav() {
  308.     document.getElementById("mySidenav").style.width = "150px";
  309.     document.getElementById("main").style.marginLeft = "150px";
  310. }
  311.  
  312. /* Set the width of the side navigation to 0 and the left margin of the page content to 0 */
  313. function closeNav() {
  314.     document.getElementById("mySidenav").style.width = "0";
  315.     document.getElementById("main").style.marginLeft = "0";
  316. }
  317.  
  318. </script>
  319. </div>
  320. </body>
  321.  
  322. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement