Jump to content

Config.php


Guest FirefoxRocks
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...