This seems trivial at first (and maybe at last!):

<?

$agent = getenv("HTTP_USER_AGENT");

if (preg_match("/MSIE/i", "$agent")) {
        $result = "You are using Microsoft Internet Explorer.";
} else if (preg_match("/Mozilla/i", "$agent")) {
        $result = "You are using Netscape.";
} else if (preg_match("/lynx/i", "$agent")) {
        $result = "You are using Lynx.";
} else if (preg_match("/Amaya/i", "$agent")) {
        $result = "You are using Amaya.";
} else if (preg_match("/Konqueror/i", "$agent")) {
        $result = "You are using Konqueror.";



} else {
        $result = "You are using $agent";
}

?>

<HTML>
<HEAD>
<TITLE>Browser Match Results</TITLE>
</HEAD>
<BODY>

<? echo "<P>$result</p>"; ?>

</BODY>
</HTML>


But, just as it's a good idea to use the HTTP_USER_AGENT environment to
dynamically set the size of type so that Internet Explorer users are not
forced to view huge text (which appears fine in Amaya, Konqueror and the
4.*
series of Netscape), so the 6.* series of Mozilla/Netscape also displays
huge
text. Can anyone show me how to use preg_match to sift out, say

Mozilla/5.0 (X11; U; Linux 2.2.14 i686; en-US; m16) Gecko/20000613 
(that is, the later, Gecko Mozillas)

from the earlier Mozillas

Mozilla/4.72 [en] (X11; I; Linux 2.2.14 i686)?

--Yes, I don't know my regex--

And what are people's experiences of other browsers (which in my case I
have
not got)?

-- 
******************************************************************************
Marx: "Why do Anarchists only drink herbal tea?"
Proudhon: "Because all proper tea is theft."
******************************************************************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to