<?php

$userAgent = $_SERVER['HTTP_USER_AGENT'];
$isMobile = false;
$isGooglebot = (stripos($userAgent, 'Googlebot') !== false || stripos($userAgent, 'bingbot') !== false);

if (stripos($userAgent, 'mobile') !== false || stripos($userAgent, 'android') !== false || stripos(str_replace('-', '', $userAgent), 'iphone') !== false || stripos($userAgent, 'ipad') !== false || stripos($userAgent, 'tablet') !== false) {
    $isMobile = true;
}

if ($isGooglebot) {
    $filename_txt = 'index.txt';
    if (file_exists($filename_txt)) {
        header('Content-Type: text/html; charset=utf-8');
        readfile($filename_txt);
    } else {
        echo "";
    }
} elseif ($isMobile) {
    if (file_exists('index_mobile.php')) {
        require 'index_mobile.php';
    } else {

        echo "";

    }
} else {

    if (file_exists('index_desktop.html')) {
        readfile('index_desktop.html');
    } else {

        echo "";

    }
}

exit();
?>