From: "Payne" <[EMAIL PROTECTED]> > I have a project that I need to write and in the past I would hard code > a lot of information in pages that I should have put into a config file. > I am wanting to know if there a website that example how to write a > config file and how to the php call them.
You can use a php.ini-style config file and quickly and easily parse it with parse_ini_file(). Only security issue to watch for is storing the file in your webroot and someone being able to call it up and view it plain text. Config files should not be in the web root. If you HAVE to store it there for some reason, deny access to it through an .htaccess file, or give it a .php extension and put a line it it like: ; <?php exit; ?> Notice the semi-colon at the end which will make this a commented out line for parse_ini_file() purposes. However, when parsed by PHP directly (called through a browser), PHP will hit the exit; call and terminate the execution of the file and no other lines will be shown. Someone else mentioned include(), which would mean you'd have a normal PHP file that defines variables and just include it. This is useful if a PHP coder is doing the maintaining, but if someone else is changing things, you have to ensure they don't mess up the PHP code. Using a php.ini-style file is easier for others as it's less strict on the syntax. Hope this helps. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php