Sebastian Kiefer
Mitglied
Hallo zusammen,
ich habe ein script das eine config datei erstellt und mehre Konstanten definiert mit placeholdern
Das funktioniert aber nicht. Hat einer eine Idee wie man das macht?
script:
ich habe ein script das eine config datei erstellt und mehre Konstanten definiert mit placeholdern
Das funktioniert aber nicht. Hat einer eine Idee wie man das macht?
script:
PHP:
<?php
$q = $_GET["q"];
$data = array("LANGUAGE" => "%LANGUAGE%",
"DB_HOST" => "%DB_HOST%",
"DB_USER" => "%DB_USER%",
"DB_PASS" => "%DB_PASS%"
);
$includedatei = "config.php";
$include = @fopen($includedatei, "a+");
foreach ($data as $key => $value) {
$includedatei = "config.php";
$include = @fopen($includedatei, "w+");
$includetext = "define('".$key."', '".$value."');";
echo $includetext;
@fputs($include, "$includetext");
}
@fclose($include);
//Template einlesen
$temp = "config.php";
$includetemplate= fopen ($temp,"r+");
$includetext = file_get_contents($temp);
$result = str_replace("%LANGUAGE%",$q,$includetext);
$res = fputs($includetemplate, $result);
fclose($includetemplate);
if ($res) {
echo "Alles Super";
}
?>