v0.0.2
This commit is contained in:
28
irpg-web/makeworldmap.php
Normal file
28
irpg-web/makeworldmap.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
include("config.php");
|
||||
|
||||
// use sessions to generate only one map / person / 20s
|
||||
session_start();
|
||||
if (isset($_SESSION['time']) && time()-$_SESSION['time'] < 20) {
|
||||
header("Location: maperror.png");
|
||||
exit(0);
|
||||
}
|
||||
$_SESSION['time']=time();
|
||||
|
||||
$file = fopen($irpg_db,"r");
|
||||
fgets($file);
|
||||
$map = imageCreate(500,500);
|
||||
$magenta = ImageColorAllocate($map, 255, 0, 255);
|
||||
$blue = imageColorAllocate($map, 0, 128, 255);
|
||||
$red = imageColorAllocate($map, 211, 0, 0);
|
||||
ImageColorTransparent($map, $magenta);
|
||||
while ($line=fgets($file)) {
|
||||
list(,,,,,,,,$online,,$x,$y) = explode("\t",trim($line));
|
||||
if ($online == 1) imageFilledEllipse($map, $x, $y, 3, 3, $blue);
|
||||
else imageFilledEllipse($map, $x, $y, 3, 3, $red);
|
||||
}
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagePNG($map);
|
||||
imageDestroy($map);
|
||||
?>
|
||||
Reference in New Issue
Block a user