-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegionsgeneratorV1_2.php
360 lines (243 loc) · 10.3 KB
/
RegionsgeneratorV1_2.php
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
<!DOCTYPE html><html><head><meta charset="utf-8">
<!--
OpenSim Regions Generator V1.05 by Manfred Aabye
Benötigte Dateien für OpenSim Regions Generator V1.06
w3.css
Language ("lang/xx.php"):
de.php Deutsch
en.php English
es.php España
fr.php française
jp.php 日本国
nl.php Nederland
pt.php Portuguesa
-->
<link id="main" rel="stylesheet" href="http://www.w3schools.com/lib/w3.css" type="text/css" media="screen"/>
<?php include("lang/de.php"); ?>
</head>
<title><?php echo $gb_Regionsgenerator; ?></title>
</head>
<body>
<div class="w3-container w3-blue-grey">
<h1><?php echo $gb_Regionsgenerator; ?></h1>
</div>
<?php if (!isset($_POST['etape'])): ?>
<form class="w3-container" action="" method="post">
<input type="hidden" name="etape" value="1" />
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Regionsname; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="Welcome" name="osRegionsname" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Lokalx; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="1100" name="osLocationx" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Lokaly; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="1100" name="osLocationy" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Port; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="9100" name="osInternalPort" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_ExterneIP; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="SYSTEMIP" name="osExternalHostName" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Regionsgr; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="512" name="osSize" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Landep; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="128,128,30" name="osDefaultLanding" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Prim; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="1024" name="osNonPhysicalPrimMax" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_MaxPrim; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="15000" name="osMaxPrims" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_MaxBesuch; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="20" name="osMaxAgents" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Vorname; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="Test" name="osMasterAvatarFirstName" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Nachname; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="User" name="osMasterAvatarLastName" maxlength="40" />
</div>
</div>
<div class="form-group">
<label for="base" class="w3-label w3-text-red control-label"><?php echo $gb_Benutzer; ?></b></label>
<div class="col-sm-4">
<input class="w3-input w3-border" type="text" placeholder="-1" name="osMaxPrimsPerUser" maxlength="40" />
</div>
</div>
<br>
<!-- Install Button -->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="w3-btn-block w3-blue-grey" type="submit" name="submit" value="Installer"><?php echo $gb_Erstellen; ?></button>
</div>
</div>
</form>
<?php endif ?>
</div>
<!-- UUID Generator -->
<?php
function v4()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
mt_rand(0, 0x0fff) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
// Pseudo-random UUID
// $v4uuid = UUID::v4();
?>
<!-- Datei löschen -->
<?php if (isset($_POST['delete']))
{
unlink('Regions.ini');
header('Location: ./');
}
?>
<!-- Datei Download -->
<?php
function DownloadFile($file) { // $file = include path
if(file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
}
?>
<?php
if (isset($_POST['etape']) AND $_POST['etape'] == 1)
{
// eine Konstante erzeugen, die später verwendet wird
define('RETOUR', '<input class="btn btn-primary" type="button" value="Return of form" onclick="history.back()">');
$osRegionsname = trim($_POST['osRegionsname']);
$datei = './' . $osRegionsname . '.ini';
$file = $osRegionsname . '.ini';
unlink($datei);
if (file_exists($datei) AND filesize($datei ) > 0)
{
// wenn die Datei existiert und nicht leer ist, dann
exit('<div class="alert alert-danger">Datei Existiert oder ist nicht leer.</div>'. RETOUR);
}
// wir schaffen unsere Variablen und alle Leerzeichen beiläufig entfernen
$v4uuid = v4();
$osLocationx = trim($_POST['osLocationx']);
$osLocationy = trim($_POST['osLocationy']);
$osInternalPort = trim($_POST['osInternalPort']);
$osExternalHostName = trim($_POST['osExternalHostName']);
$osSize = trim($_POST['osSize']);
$osDefaultLanding = trim($_POST['osDefaultLanding']);
$osNonPhysicalPrimMax = trim($_POST['osNonPhysicalPrimMax']);
$osMaxPrims = trim($_POST['osMaxPrims']);
$osMaxAgents = trim($_POST['osMaxAgents']);
$osMasterAvatarFirstName = trim($_POST['osMasterAvatarFirstName']);
$osMasterAvatarLastName = trim($_POST['osMasterAvatarLastName']);
$osMaxPrimsPerUser = trim($_POST['osMaxPrimsPerUser']);
// der Text, der in der Regions.ini gesetzt wird
$texte = '
; Datei '.$osRegionsname.'.ini erstellt mit dem Regions Generator v1.0
['.$osRegionsname.']
RegionUUID = '.$v4uuid.'
Location = '.$osLocationx.','.$osLocationy.'
InternalAddress = 0.0.0.0
InternalPort = '.$osInternalPort.'
AllowAlternatePorts = False
ExternalHostName = '.$osExternalHostName.'
SizeX = '.$osSize.'
SizeY = '.$osSize.'
SizeZ = '.$osSize.'
DefaultLanding = <'.$osDefaultLanding.'>
NonPhysicalPrimMax = '.$osNonPhysicalPrimMax.'
PhysicalPrimMax = 64
ClampPrimSize = False
MaxPrims = '.$osMaxPrims.'
MaxAgents = '.$osMaxAgents.'
MaxPrimsPerUser = '.$osMaxPrimsPerUser.'
MasterAvatarFirstName = '.$osMasterAvatarFirstName.'
MasterAvatarLastName = '.$osMasterAvatarLastName.'
; Ende '.$osRegionsname.'.ini
';
// ini Datei schreiben
if (!$offen = fopen($datei, 'w'))
{
exit('<div class="alert alert-danger">Öffnen fehlgeschlagen Datei : <strong>'. $datei .'</strong>, Dateifehler (' . $osRegionsname . '.ini) Verzeichnis nicht beschreibbar.</div>'. RETOUR);
}
if (fwrite($offen, $texte) == FALSE)
{
exit('<div class="alert alert-danger">Can not write to the file : <strong>'. $datei .'</strong>, Dateifehler (' . $osRegionsname . '.ini) Verzeichnis nicht beschreibbar.</div>'. RETOUR);
}
echo '<div class="alert alert-success">Creation of effected regions file with success ...</div>';
fclose($offen);
echo '<div class="alert alert-success">Installing the ' . $osRegionsname . '.ini of data effected with success...</div>';
echo '<form class="form-group" action="" method="post">';
echo '<input type="hidden" name="delete" value="1" />';
echo '<div class="form-group">';
echo '<button class="btn btn-danger" type="submit" name="submit" >Delete file Regions.ini</button>';
echo '</div>';
echo '</form>';
// Datei Download
DownloadFile($file);
// Datei löschen
unlink($datei);
}
?>
<div class="clearfix"></div>
</div>
</body>
</html>