On the login page you can use logic to set:
if ($_SESSION['adminID'] == 1) {
$_SESSION['admindomain'] = $_SERVER['SERVER_NAME'];
}
Then use the domain setting of:
<?php echo(isset($_SESSION['admindomain'])?$_SESSION['admindomain']:"fail"); ?>
There are actually multiple ways to accomplish this result, but this is the most similar to what you have already.