EMB Elizabeth Best's professional logo

Elizabeth M Best

Web Portfolio

Elizabeth Best's portrait

Portofolio Code Snips - Config File

config_sample.php File


<?php
/** CODE SAMPLE: SITE CONFIG FILE ***
Created by Elizabeth Best (with a shoutout to who ever came up with this idea!)

For where to use this code, please see 'index_sample.php'. Also rename this file to 'config.php' for your server to correctly parse.

This file is CRITICAL for the entire scheme to work. It sets a PHP string constant to the website root directory based upon whether it detects a certain file present. 
Ideally, it is a notes text file that you DO NOT plan to upload to a live server. The Constant will either set to your sandbox site domain or your live production server url.
**/



/**PHP settings for site **/


/** --Test for Local vs. prod enviroment and set appropriate constants.
 It looks for file listed here, and this file should NEVER be uploaded to live server! File must exist and can be named anything. -- */
if ( file_exists( dirname( __FILE__ ) . '/doNotUpload.txt' ) ) {

	/* constants for LOCALHOST SERVER, your sandbox address */
	define('DOC_ROOT','yourlocalserveraddress.com');

	/* add possible SQL database params */

} else {
	/* constants for PRODUCTION (LIVE) Server, be sure to change these to your actual site */
	define('DOC_ROOT','yourlivehostedsite.com');

	/* add possible SQL database params */

}

?>