| [1451] | 1 | <?
 | 
|---|
 | 2 |     include("config.php");
 | 
|---|
 | 3 |     $file = fopen($irpg_db,"r");
 | 
|---|
 | 4 |     fgets($file,1024);
 | 
|---|
 | 5 |     $itemfile = fopen($irpg_itemdb,"r");
 | 
|---|
 | 6 |     fgets($itemfile,1024);
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 |     session_start(); // sessions to generate only one map / person / 20s
 | 
|---|
 | 9 |     if (isset($_SESSION['time']) && time()-$_SESSION['time'] < 20) {
 | 
|---|
 | 10 |         header("Location: maperror.png");
 | 
|---|
 | 11 |         exit(0);
 | 
|---|
 | 12 |     }
 | 
|---|
 | 13 |     $_SESSION['time']=time();
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 |     $map = imageCreate(500,500);
 | 
|---|
 | 16 |     $magenta = ImageColorAllocate($map, 255, 0, 255);
 | 
|---|
 | 17 |     $blue = imageColorAllocate($map, 0, 128, 255);
 | 
|---|
 | 18 |     $red = imageColorAllocate($map, 211, 0, 0);
 | 
|---|
 | 19 |     $orange = imageColorAllocate($map, 255, 128, 0);
 | 
|---|
 | 20 |     $yellow = imageColorAllocate($map, 255, 192, 0);
 | 
|---|
 | 21 |     ImageColorTransparent($map, $magenta);
 | 
|---|
 | 22 |     while ($line=fgets($file,1024)) {
 | 
|---|
 | 23 |         list(,,,,,,,,$online,,$x,$y) = explode("\t",trim($line));
 | 
|---|
 | 24 |         if ($online == 1) $color = $blue;
 | 
|---|
 | 25 |         else $color = $red;
 | 
|---|
 | 26 |         imageLine($map, $x-$crosssize, $y, $x+$crosssize, $y, $color);
 | 
|---|
 | 27 |         imageLine($map, $x, $y-$crosssize, $x, $y+$crosssize, $color);
 | 
|---|
 | 28 |     }
 | 
|---|
 | 29 |     while ($line=fgets($itemfile,1024)) {
 | 
|---|
 | 30 |         list($x,$y,,$level) = explode("\t",trim($line));
 | 
|---|
 | 31 |         if (is_numeric($level)) $color = $orange;
 | 
|---|
 | 32 |         else $color = $yellow;
 | 
|---|
 | 33 |         imageLine($map, $x-$crosssize, $y-$crosssize, $x+$crosssize, $y+$crosssize, $color);
 | 
|---|
 | 34 |         imageLine($map, $x+$crosssize, $y-$crosssize, $x-$crosssize, $y+$crosssize, $color);
 | 
|---|
 | 35 |     }
 | 
|---|
 | 36 |     header("Content-type: image/png");
 | 
|---|
 | 37 |     imagePNG($map);
 | 
|---|
 | 38 |     imageDestroy($map);
 | 
|---|
 | 39 | ?>
 | 
|---|