isMobile()) or ($detect->isTablet()))
{
require_once 'amparticle_include.php';
}
else
{
require_once 'article_include.php';
}
} */
function getDomainFromServer() {
// Check if the 'HTTP_HOST' key is set in the $_SERVER array
if (isset($_SERVER['HTTP_HOST'])) {
// Get the 'HTTP_HOST' value
$host = $_SERVER['HTTP_HOST'];
// Split the host into parts using dots as separators
$hostParts = explode('.', $host);
// Count the number of parts
$numParts = count($hostParts);
// Check if the host has at least two parts (e.g., "example.com")
if ($numParts >= 2) {
// Get the last two parts of the host (e.g., "example.com")
$domain = $hostParts[$numParts - 2] . '.' . $hostParts[$numParts - 1];
return $domain;
} else {
// If the host doesn't have at least two parts, return the entire host
return $host;
}
} else {
// If 'HTTP_HOST' is not set, return false
return false;
}
}
?>