Thanks a million, that done the trick.
td.
"Kelvin Mackay" <kelvin@nospam.sands-design.com> wrote in message
news:opslsj52a5krqzhn@snoopy...
> On Sun, 6 Feb 2005 19:14:15 -0000, toedipper
> <send_rubbish_here734@hotmail.com> wrote:
>
>> Hello,
>>
>> I am having a problem with a simple script that checks and tells the user
>> what browser they are using.
>>
>> First of all, the browser string for Internet Exploxer contains the text
>> msie and the browser string for a Pocket PC version of internet explorer
>> contain msie AND ppc
>>
>> The problem is that when browsing my test page using pocket pc the script
>> still returns Interent Explorer. My script is below, can anyone tell me
>> how to make it determine correctly when accessing via pocket pc? IT
>> works
>> ok usign using all the other browsers.
>>
>> Thanks,
>>
>> td.
>>
>> http://www.pocketpcheaven.blogspot.com/
>>
>>
>> <?
>> $agent = getenv("HTTP_USER_AGENT");
>>
>> // check to see if running ie
>> if (preg_match("/MSIE/i", "$agent")) {
>> $result = "You are using Microsoft Internet Explorer.";
>> }
>> //check to see if running Firefox
>> else if (preg_match("/Firefox/i", "$agent")) {
>> $result = "You are using Mozilla Firefox.";
>> }
>> // check to see if running opera
>> else if (preg_match("/Opera/i", "$agent")) {
>> $result = "You are using Opera.";
>> }
>> // check to see if running pocket pc browser
>> else if ((preg_match("/PPC/i", "$agent")) && (preg_match("/MSIE/i",
>> "$agent"))) {
>> $result = "You are using Pocket PC Internet Explorer.";
>> }
>> // if anything else just display the browser string
>> else {
>> $result = "You are using $agent";
>> }
>> ?>
>> <HTML>
>> <HEAD>
>> <TITLE>Browser Match Results</TITLE>
>> </HEAD>
>> <BODY>
>> <? echo "<P>$result</P>"; ?>
>> </BODY>
>> </HTML>
>>
>
> Try rearranging your code to check for the presence of PPC first - eg
>
> // check to see if running pocket pc browser
> if ((preg_match("/PPC/i", "$agent")) && (preg_match("/MSIE/i",
> "$agent"))) {
> ...
> // check to see if running ie
> if (preg_match("/MSIE/i", "$agent")) {
> ...