Jump to content

Config.php


Guest FirefoxRocks

Recommended Posts

Guest FirefoxRocks

Is it a good idea to have a config.php file for anything important for the application to run? What I mean is that like when you install phpBB3, Joomla! or applications like that, during installation it asks that you make your config.php file writable so that it can write variables to it.Right now I'm storing all my variables in the database except for the database server, database name, user and password.

Link to comment
Share on other sites

i tend to use define() on files like a config or functions file (or anyfile that is never called up directly but included in a main script).so for example in the main file e.g. index.php

<?php//Define constantdefine("CONSTANTNAME", "true");//Then include the config fileinclude('config.php');?>

and in the file to be included eg config.php

<?php//Check if file is defineddefined('CONSTANTNAME') or die('HACKING ATTEMPT');?>

seen this used in various major php scripts for a bit of security

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...