<?php

function browser() {
    $user_agent = $_SERVER["HTTP_USER_AGENT"];
    if (strpos($user_agent, "Firefox") !== false) {
        $browser = "Firefox";
    } elseif (strpos($user_agent, "Opera") !== false) {
        $browser = "Opera";
    } elseif (strpos($user_agent, "Chrome") !== false) {
        $browser = "Chrome";
    } elseif (strpos($user_agent, "MSIE") !== false) {
        $browser = "Internet Explorer";
    } elseif (strpos($user_agent, "Safari") !== false) {
        $browser = "Safari";
    } else {
        $browser = "Неизвестный";
    }
    echo "$browser";
}

function getbrowser_($br = null) {

    if ($br != null) {
        switch ($br) {
            default: echo "<img src='/style/browser/mobile.png'> Использует мобильное устроиство";
                break;

            case 'Netscape': echo " <small><i class='fa fa-globe fa-fw'></i></small> ";
                break;
            case 'Opera Mini': echo " <small><i class='fa fa-opera fa-fw'></i></small> ";
                break;
            case 'Chrome': echo " <small><i class='fa fa-chrome fa-fw'></i></small> ";
                break;
            case 'safari': echo " <small><i class='fa fa-safari fa-fw'></i></small> ";
                break;
            case 'MSIE 6.0': echo " <small><i class='fa fa-internet-explorer fa-fw'></i></small> ";
                break;
            case 'MSIE 7.0': echo " <small><i class='fa fa-internet-explorer fa-fw'></i></small> ";
                break;
            case 'MSIE 8.0': echo " <small><i class='fa fa-internet-explorer fa-fw'></i></small> ";
                break;
            case 'Firefox': echo " <small><i class='fa fa-firefox fa-fw'></i></small> ";
                break;
            case 'Opera': echo " <small><i class='fa fa-opera fa-fw'></i></small> ";
                break;
            case 'Android': echo " <small><i class='fa fa-android fa-fw'></i></small> ";
                break;
            case 'iPhone': echo " <small><i class='fa fa-apple fa-fw'></i></small> ";
                break;
            case 'Windows': echo " <small><i class='fa fa-windows fa-fw'></i></small> ";
                break;
            case 'WindowsPhone': echo " <small><i class='fa fa-windows fa-fw'></i></small> ";
                break;
            case 'iPod': echo " <small><i class='fa fa-apple fa-fw'></i></small> ";
                break;
            case 'BlackBerry': echo " <small><i class='fa fa-globe fa-fw'></i></small> ";
                break;
            case 'Ucweb': echo " <small><i class='fa fa-globe fa-fw'></i></small> ";
                break;
        }
    }
}
