PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I need to make a page that gets all these variables and makes them into a form, so one can edit the variables and remake the config.php file with the new variables.
I was doing this using a static form posting to a page that use fwrite to write the entire php file over again.
Well, you could use a database and have it dynamically pull the values from the table. That way you wouldn't have to re-write the config file each time, just query the database for the appropriate values.
One method I like to use is an INI file, but named with a .php extension. So that people can't see the settings though, you put some php exit() or die() code on the first line, commented so the ini parser doesn't mind.
$config = parse_ini_file('config.php');
// You can access the individual settings like so:
$connection = mysql_connect($config['host'], $config['user'], $config['pass']);