hello,
i've written a configuration tool for a website. that tool saves the configuration as an array, which is exported to a file using the var_export-function (see code below).
the whole thing works fine, i've only one problem. theres an entry "ROOT_WWW", that contains the path to the site (including the servername). because the server can be accessed via an internal ip (192.168.) or by an external ip, so i am using the following config in my array:
array ("ROOT_WWW" => "http://$GLOBALS[SERVER_NAME]/edith5_test")
problem: when i save the array using the functions below, the variable $GLOBALS[...] gets replaced by the value (f.e. 192.168.1.5 - the internal ip):
'ROOT_WWW' => 'http://192.168.1.5/schladminger'
as a result, the site cant be accessed from outside the lan.
question: is there a way to modify the code, so that it does NOT replace the variable, but saves it as it is.
my code:
function writeConfigToFile ()
{
global $siteinfo, $conf_file, $filehandler;
$filehandler = fopen ($conf_file, "w");
ob_start ("writeIt");
echo '<?php $siteinfo = ';
var_export ($siteinfo);
echo ' ?>';
ob_end_flush();
fclose ($filehandler);
}
function writeIt ($buffer)
{
global $filehandler;
fputs ($filehandler, $buffer);
}
i'd be very thankful for every hint.
stefan