Hi
I run versions of sites on a local server. For these the path to a mysql connection script is pretty simple: mysql_connec.php
On my live server, I put things out of the public directory - so this time the path is ../mysql_connect.php
I therefore have to have sections like this in my files = and whilst not complex, its a pain having to uncomment/comment lines depending on which server I am working because I keep forgetting!
// require_once('../../workRecord/mysql_connect.php'); //online
require_once('mysql_connect.php'); //local
Is there some way I can identify which server I am on so I don't keep having to do this. I was thinking of using something like this:
if ($_SERVER['DOCUMENT_ROOT']=="c:/web_root/blah/blah"){
require_once('mysql_connect.php');
}else{
require_once('../../workRecord/mysql_connect.php');
}
I am pretty sure this would work, but does this method present any security issues???