if (getenv('REMOTE_ADDR')=='localhost'){ // Local host için ayar
$db = new DB('localhost','dbkullaniciadi', 'sifre', 'dbadi');
}else{
$db = new DB('localhost','dbkullaniciadi', 'sifre', 'dbadi');


Bu şekilde olacaktır büyük ihtimalle.