I came across a similar question once on SO but didn't mark it and can't find it now.
Currently my init.php
file looks like this:
$db_username = user;
$db_password = pass;
//$db_username = user213124; // webhost
//$db_password = pass214142; // webhost
and I alternately comment/uncomment those lines depending on if its running on my test machine's XAMPP installation or on my webhost.
Sometimes I forget, and upload the wrong one, which is always good for a laugh.
I'm sure there's a way to write a short function allowing init.php
to detect its location and use the appropriate username/pass combo.
The first solution that popped into my head was a simple if(file_exists()) {}
and checking for something that would ONLY be on my test machine. I'm guessing there's a better way that doesn't prompt disk access though, amirite?
Thank you.
PS - please edit my subject to make it more accurate. Tried my best. Kinda hard to describe...