Advertisement
mbeersnl

Map klein

Aug 4th, 2014
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <?php
  2. set_time_limit(10800);
  3. if(!$_POST)
  4. {
  5.     for($y=40;$y>=34;$y--) {
  6.         for($x=1;$x<=7;$x++) {
  7.             require_once('includes/db/DbConnector.php');
  8.             $connector = new DbConnector();
  9.             $result = $connector->query('SELECT * FROM map WHERE x = "'.$x.'" AND y = "'.$y.'" ');
  10.             while($row = $connector->fetchArray($result))
  11.  
  12.             echo '<img src="images/map/lan_'.$row['tip'].$row['subtip'].'.gif" style="float: left;margin: 0;padding:0;">';
  13.         }
  14.     }
  15.  
  16.     echo '<div style="margin-top: 380px;">';
  17.     echo '<form method="POST" action="map.php">';
  18.     echo 'x: <input type="text" style="width:50px;" name="x"><br>';
  19.     echo 'y: <input type="text" style="width:50px;" name="y"><br>';
  20.     echo '<input type="submit" name="submit" value="Cauta!"><br>';
  21.     echo '</form>';
  22.     echo '</div>';
  23.  
  24. }
  25. else
  26. {
  27.     $cx = $_POST['x'];
  28.     $cy = $_POST['y'];
  29.  
  30.     $cy1 = $cy+3;
  31.     $cx1 = $cx-3;
  32.  
  33.     $cy2 = $cy-3;
  34.     $cx2 = $cx+3;
  35.  
  36.     for($y=$cy1;$y>=$cy2;$y--) {
  37.         for($x=$cx1;$x<=$cx2;$x++) {
  38.             require_once('includes/db/DbConnector.php');
  39.             $connector = new DbConnector();
  40.             $result = $connector->query('SELECT * FROM map WHERE x = "'.$x.'" AND y = "'.$y.'" ');
  41.             while($row = $connector->fetchArray($result))
  42.  
  43.             echo '<img src="images/map/lan_'.$row['tip'].$row['subtip'].'.gif" title="('.$row['x'].'|'.$row['y'].')" style="float: left;margin: 0;padding:0;">';
  44.         }
  45.     }
  46.  
  47.     echo '<div style="margin-top: 380px;">';
  48.     echo '<form method="POST" action="map.php">';
  49.     echo 'x: <input type="text" style="width:50px;" name="x" value="'.$_POST['x'].'"><br>';
  50.     echo 'y: <input type="text" style="width:50px;" name="y" value="'.$_POST['y'].'"><br>';
  51.     echo '<input type="submit" name="submit" value="Cauta!"><br>';
  52.     echo '</form>';
  53.     echo '</div>';
  54. }
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement