Repository navigation
Expand file tree
/
Copy pathmap.php
More file actions
411 lines (317 loc) · 15.2 KB
/
Copy pathmap.php
File metadata and controls
411 lines (317 loc) · 15.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<!DOCTYPE html><html><head><meta charset="utf-8">
<link id="main" rel="stylesheet" href="http://www.w3schools.com/lib/w3.css" type="text/css" media="screen"/>
</head>
<title>openSIMULATOR RegionsMap Karte</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
</head>
<body>
<div class="w3-container w3-blue-grey">
<h1>openSIMULATOR RegionsMap Karte</h1>
</div>
<!--
* Copyright (c) Metropolis Metaversum [ http://hypergrid.org ]
*
* The MetroTools are BSD-licensed. For more infornmations about BSD-licensed
* Software use this link: http://www.wikipedia.org/BSD-License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Metropolis Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
-->
<?php
// ------------------------------------------------------------------------------------
// Change this items to your Language
// ------------------------------------------------------------------------------------
$CONF_txt_north = "Norden";
$CONF_txt_south = "Sueden";
$CONF_txt_west = "Westen";
$CONF_txt_east = "Osten";
$CONF_txt_center = "Center";
$CONF_txt_refresh = "Refresh";
$CONF_txt_occupied = "Besetzt";
$CONF_txt_free = "FREI";
$CONF_txt_coords = "Koordinaten";
// Konfiguration einbinden
include("./includes/config.php");
// Daten aus der Konfiguration
$dbort = $CONF_db_server;
$dbuser = $CONF_db_user;
$dbpw = $CONF_db_pass;
$dbdb = $CONF_db_database;
$grid_x = 0;
$grid_y = 0;
if (isset($_POST['x']) && ($_POST['y']))
{
$grid_x = $_POST['x'];
$grid_y = $_POST['y'];
}
else
{
if (isset($_GET['x']) && ($_GET['y']))
{
$grid_x = $_GET['x'];
$grid_y = $_GET['y'];
}
}
if ($grid_x == 0) {$grid_x = $CONF_center_coord_x;}
if ($grid_y == 0) {$grid_y = $CONF_center_coord_y;}
if ($grid_y <= 30) {$grid_y = "100";}
if ($grid_x <= 30) {$grid_x = "100";}
if ($grid_x >=99999) {$grid_x = $CONF_center_coord_x;}
if ($grid_y >=99999) {$grid_y = $CONF_center_coord_y;}
$start_x = $grid_x - 20;
$start_y = $grid_y + 10;
$end_x = $grid_x + 20;
$end_y = $grid_y - 10;
// Datenbank anzapfen
$con = mysqli_connect($dbort,$dbuser,$dbpw,$dbdb);
// Datenbank abfragen
$z=mysqli_query($con,"SELECT uuid,regionName,locX,locY,serverURI,sizeX,sizeY,owner_uuid FROM regions") or die("Error: " . mysqli_error($con));
/* Datenbank prüfen */
if (mysqli_connect_errno())
{
printf("Datenbank Fehler: %s\n", mysqli_connect_error());
exit();
}
$xx=0;
if ($region['sizeX'] == 0) {$region['sizeX'] = 256; }
if ($region['sizeY'] == 0) {$region['sizeY'] = 256; }
while($region=mysqli_fetch_array($z))
{
if ((($region['sizeX'] == 256) && ($region['sizeY'] == 256)) || (($region['sizeX'] == 256) && ($region['sizeY'] == 0)))
{
$work_reg = $region['uuid'].";".$region['regionName'].";".$region['locX'].";".$region['locY'].";".$region['serverURI'].";".$region['sizeX'].";".$region['sizeY'].";".$region['owner_uuid'].";SingleRegion";
$region_sg[$xx] = $work_reg;
$xx++;
}
else
// **********************************************************
{
$varreg_locx = ($region['locX'] / 256);
$varreg_locy = ($region['locY'] / 256);
$varreg_start_x = $varreg_locx;
$varreg_start_y = $varreg_locy;
$varreg_end_x = $varreg_locx + (($region['sizeX'] / 256) - 1);
$varreg_end_y = $varreg_locy + (($region['sizeY'] / 256) - 1);
$varreg_work_x = $varreg_start_x;
$varreg_work_y = $varreg_start_y;
while (($varreg_work_y <= $varreg_end_y)&& ($varreg_work_x <= $varreg_end_x))
{
$varreg_key = $varreg_work_x."-".$varreg_work_y;
$work_reg = $region['uuid'].";".$region['regionName'].";".$varreg_work_x.";".$varreg_work_y.";".$region['serverURI'].";".$region['sizeX'].";".$region['sizeY'].";".$region['owner_uuid'].";VarRegion";
$region_sg[$xx] = $work_reg;
$xx++;
if (($varreg_work_y == $varreg_end_y)&& ($varreg_work_x == $varreg_end_x))
{}
if ($varreg_work_y == $varreg_end_y)
{
$varreg_work_y = $varreg_start_y;
$varreg_work_x++;
}
else
{
$varreg_work_y++;
}
}
}
// ********************************************************
}
?>
<!-- Koordinaten Pfeile -->
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td valign=top align=center>
<br>
<img src ="./img/spacer.gif" width="15">
</td>
<td valign=top align=center>
<br>
<table width=100 height=100 cellspacing=0 cellpadding=0 border=0>
<tr>
<td align=center>
<center>
<table border=0 cellpadding=0 cellspacing=0>
<tr align=center>
<td><img src = ./img/spacer.gif></td>
<td><a href="map.php?x=<?php echo $grid_x;?>&y=<?php echo $grid_y + 10; ?>" target=_self><img src=./img/oben.png width="50" height="50" border=0 alt="<?php echo $CONF_txt_north;?>" title="<?php echo $CONF_txt_north;?>"></a></td>
<td><img src = ./img/spacer.gif></td>
</tr>
<tr>
<td><a href="map.php?x=<?php print $grid_x - 10; ?>&y=<?php print $grid_y; ?>" target=_self><img src=./img/links.png width="50" height="50" border=0 alt="<?php echo $CONF_txt_west;?>" title="<?php echo $CONF_txt_west;?>"></a></td>
<td><a href="map.php?x=<?php echo $CONF_center_coord_x;?>&y=<?php echo $CONF_center_coord_y;?>" target=_self><img src=./img/home.png width="50" height="50" border=0 alt="<?php echo $CONF_txt_center;?>" title="<?php echo $CONF_txt_center;?>"></a></td>
<td><a href="map.php?x=<?php print $grid_x + 10; ?>&y=<?php print $grid_y; ?>" target=_self><img src=./img/rechts.png width="50" height="50" border=0 alt="<?php echo $CONF_txt_east;?>" title="<?php echo $CONF_txt_east;?>"></a></td>
</tr>
<tr>
<td><img src = ./img/spacer.gif></td>
<td><a href="map.php?x=<?php print $grid_x; ?>&y=<?php print $grid_y -10; ?>" target=_self><img src=./img/unten.png width="50" height="50" border=0 alt="<?php echo $CONF_txt_south;?>" title="<?php echo $CONF_txt_south;?>"></a></td>
<td><img src = ./img/spacer.gif></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Koordinaten eingabe -->
<br><br>
<table class="w3-table">
<tr>
<td align=center valign=middle>
<center><b><br><font color=w3-dark-grey><?php echo $CONF_txt_coords;?></b><br><hr width=40%>
<table class="w3-table">
<tr>
<td align=right valign=middle border=0 width=40%>
<form name="submit" action="map.php" method="post">
<font color=w3-dark-grey><b>X:</b></font>
<img src= ./img/spacer.gif></td>
<td width=60% valign=middle align=left border=1 >
<input type="text" value="<?php print $grid_x;?>" name="x" size=4></td>
</tr>
<tr>
<td align=right border=0 valign=middle width=40%>
<font color=w3-dark-grey><b>Y:</b></font>
<img src= ./img/spacer.gif></td><td width=60% valign=middle border=1 align=left>
<input type="text" name="y" size=4 value="<?php print $grid_y;?>"></td></font>
</tr>
<tr>
<td colspan=2 align=center>
<br>
<button class="w3-btn-block w3-blue-grey" type="submit" name="submit" value="Installer">Suchen</button>
<br><br>
</form>
</b></font></td>
</tr>
</table>
</td>
</tr>
</table></td>
<td><img src=./img/spacer.gif width=10 border=0></td>
<td valign=top>
<br>
<table bordercolor=white cellpadding=1 cellspacing=1>
<?php
$y = $start_y;
$x = $start_x;
while ($y >= $end_y)
{
$x = $start_x;
?>
</td></tr><tr valign=middle><td valign=middle>
<div class="w3-opacity">
<?php
if ($y <> $start_y)
{
echo $y;
}
?>
</div>
<?php
while ($x <= $end_x)
{
if ($y == $start_y)
{
?>
</td><td align=center><div class="w3-opacity">
<?php
$xs="a";
$xs=$x;
$z1=""; $z2=""; $z3=""; $z4=""; $z5=""; $z6="";
$z1= substr($xs,'0','1');
$z2= substr($xs,'1','1');
$z3= substr($xs,'2','1');
$z4= substr($xs,'3','1');
$z5= substr($xs,'4','1');
$z6= substr($xs,'5','1');
if ($z1) {print $z1;} else {print "<br>0";}
if ($z2) {print $z2;} else {if ($x >= 10) {print "0";}}
if ($z3) {print "<br>".$z3;} else {if ($x >= 100) {print "<br>0";}}
if ($z4) {print $z4;} else {if ($x >= 1000) {print "0";}}
if ($z5) {print "<br>".$z5;} else {if ($x >= 10000) {print "<br>0";}}
if ($z6) {print $z6;} else {if ($x >= 100000) {print "0";}}
?>
</div>
<?php
$x++;
}
else
{
$count = count($region_sg);
for ($q = 0; $q < $count; $q++)
{
$region_value = $region_sg[$q];
$sim_new = 0;
list($region_uuid, $region_name, $region_locx, $region_locy, $region_serverip, $region_sizex, $region_sizey, $region_owner, $region_type) = explode(";",$region_value);
if ($region_sizey == 0) { $region_sizey = 256; }
if ($region_locx >= 100000)
{
$region_locx = $region_locx / 256;
$region_locy = $region_locy / 256;
}
if (($region_locx == $x) && ($region_locy == $y))
{ $sim_new = 1; break;}
}
$zq=mysqli_query($con,"SELECT FirstName, LastName FROM UserAccounts where PrincipalID='$region_owner';") or die("Error: " . mysqli_error($con));
$owner=mysqli_fetch_array($zq);
$firstname = $owner['FirstName'];
$lastname = $owner['LastName'];
if ($sim_new == 1)
{
if (($x == $CONF_center_coord_x) && ($y == $CONF_center_coord_y))
{
$region_dimension = ($region_sizex / 256)." x ".($region_sizey / 256)." Regions";
$region_total_size = $region_sizex * $region_sizey;
$region_total_size = number_format($region_total_size, 0, ",", ".")." sqm";
?>
</td><td><A style="cursor:pointer" "><img src="./img/grid_mainland.png" alt= " RegionName: <?php print $region_name; ?> 
 RegionType: <?php print $region_type; ?> 

 Dimension: <?php print $region_dimension ?> 
 Total size: <?php print $region_totalsize ?> 

 X-Coordinate: <?php print $x; ?> 
 Y-Coordinate: <?php print $y; ?> 

 Status: <?php echo $CONF_txt_occupied;?> 
 Owner: <?php echo $firstname.' '.$lastname;?>" title= " RegionName: <?php print $region_name; ?> 
 RegionType: <?php print $region_type; ?> 

 Dimension: <?php print $region_dimension ?> 
 Total size: <?php print $region_totalsize ?> 

 X-Coordinate: <?php print $x; ?> 
 Y-Coordinate: <?php print $y; ?> 
 Owner: <?php echo $CONF_txt_occupied;?> 
 Owner: <?php echo $firstname.' '.$lastname;?>"></A><?php
$x++;
}
else
{
if ($region_type == "SingleRegion")
{$reg_colour = "./img/grid_besetzt.png";}
if ($region_type == "VarRegion")
{$reg_colour = "./img/grid_varregion.png";}
$region_dimension = ($region_sizex / 256)." x ".($region_sizey / 256)." Regions";
$region_totalsize = $region_sizex * $region_sizey;
$region_totalsize = number_format($region_totalsize, 0, ",", ".")." sqm";
?>
</td><td><A style="cursor:pointer" "><img src="<?php print $reg_colour?>" alt= " RegionName: <?php print $region_name; ?> 
 RegionType: <?php print $region_type; ?> 
 Dimension: <?php print $region_dimension ?> 
 Total size: <?php print $region_totalsize ?> 
 X-Coordinate: <?php print $x; ?> 
 Y-Coordinate: <?php print $y; ?> 
 Status: OCCUPIED 
 Owner: <?php echo $firstname.' '.$lastname;?>" title = " RegionName: <?php print $region_name; ?> 
 RegionType: <?php print $region_type;?> 
 Dimension: <?php print $region_dimension ?> 
 Total size: <?php print $region_totalsize ?> 
 X-Coordinate: <?php print $x; ?> 
 Y-Coordinate: <?php print $y; ?> 
 Status: OCCUPIED 
 Owner: <?php echo $firstname.' '.$lastname;?>"</A>
<?php
$x++;
}}
else
{
?>
</td><td><img src="./img/grid_frei.png"
alt= " X-Coordinate: <?php print $x; ?> 
 Y-Coordinate: <?php print $y; ?> 
 Status: <?php echo $CONF_txt_free;?>"
title= " X-Coordinate: <?php print $x; ?> 
 Y-Coordinate: <?php print $y; ?> 
 Status: <?php echo $CONF_txt_free;?>">
<?php
$x++;
}
}
}
$y--;
}
?>
</td>
</tr>
</table>
</td>
<td> <img src ="./img/spacer.gif" width="15"></td>
</tr>
</table>
<img src = "./img/spacer.gif" width="600" height="1">
<img src="./img/grid_frei.png"> = Frei
<img src = "./img/spacer.gif" width="100" height="1">
<img src="./img/grid_besetzt.png"> = SingleRegion
<img src="./img/grid_varregion.png"> = VarRegion
<img src="./img/grid_mainland.png"> = Grid Zentrum
</div>
</body>
</html>