Davor da gibts nen Platzhalter der heisst {-content-} und den kann man setzen.
Codeauszug:
Bei deinem umbenenn Tool sieht das so aus:
Codeauszug:
ALTER SOURCE CODE!!
if(strpos($content,"{-"."content-}")!==false) //Allow appending of Content
{
file_put_contents("../$path",str_replace("<nsb>","\n",str_replace("{-content-}",file_get_contents("../$path"),$content)));
}else{
echo "$path<br>";
file_put_contents("../$path",str_replace("<nsb>","\n",$content));
}
if(strpos($content,"{-"."content-}")!==false) //Allow appending of Content
{
file_put_contents("../$path",str_replace("<nsb>","\n",str_replace("{-content-}",file_get_contents("../$path"),$content)));
}else{
echo "$path<br>";
file_put_contents("../$path",str_replace("<nsb>","\n",$content));
}
Code:
<?php
// By SlimShady95
$Connect = mysql_connect('localhost', 'root', '');
mysql_select_db('lan');
if($_GET['screen'] == 'overview_villages' AND $_GET['mode'] == '') {
header('Location: game.php?screen=overview_villages&mode=combined&village=' . $_GET['village']);
exit();
}
// Umbenennen
if($_GET['screen'] == 'overview_villages' AND $_GET['mode'] == 'rename') {
if($_POST) {
$Name = mysql_escape_string(htmlspecialchars($_POST['name']));
if($Name == '') {
header('Location: game.php?screen=overview_villages&mode=rename&village=' . $_GET['village'] . '&error=Bitte einen Namen eingeben.');
exit();
} else {
$Nr = 0;
// Hole alle Dörfer
$Sql = 'SELECT * FROM `villages` WHERE `id` = ' . mysql_escape_string(htmlspecialchars($_GET['village']));
$Query = mysql_query($Sql);
$Fetch_V = mysql_fetch_assoc($Query);
$Villages = array();
$Sql = 'SELECT * FROM `villages` WHERE `userid` = ' . $Fetch_V['userid'];
$Query = mysql_query($Sql);
while($Village = mysql_fetch_assoc($Query)) {
$Villages[] = $Village;
}
// Und umbenennen
foreach($Villages AS $Village) {
++$Nr;
$Vill_Name = str_replace('{NR_0}', str_pad($Nr, 3, 0, STR_PAD_LEFT), $Name);
$Vill_Name = str_replace('{NR}', $Nr, $Vill_Name);
$Vill_Name = str_replace('{x}', $Village['x'], $Vill_Name);
$Vill_Name = str_replace('{y}', $Village['y'], $Vill_Name);
$Sql = 'UPDATE `villages` SET `name` = \'' . $Vill_Name . '\' WHERE `id` = ' . $Village['id'];
$Query = mysql_query($Sql);
}
}
}
}
//Ported to Installer by steffengy
unset($Connect);
?>{-content-}
LG
steffen
steffen