I have written a small script in order to check the browser of the user and find that the code isnt working , even if i open the php page in IE its still outputting Mozilla

<?php
$browser =  $_SERVER['HTTP_USER_AGENT'] ;
echo  $browser. "\n\n";
?>

Output in Mozilla:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6

Output in IE:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)

i aint have ne idea on whats wrong with the output .

There is nothing wrong with the output, correct browser strings, you did not bother to look up what the http_user_agent strings were
design your code around the actual values of the variable, the variable will not alter to suit your expectations

windows xp really needs to be updated beyound service pack one

got it .. i did a little bit of tweaking and i guess this works ...
i would be glad if you could test it .. just in case .

<?php
function detect_ie()
{
    if (isset($_SERVER['HTTP_USER_AGENT']) && 
    (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
        return true;
    else
        return false;
}
?>
Welcome to the site.


<?php  
if (detect_ie()) {  
echo "<script> alert('It seems, that you are using IE. Why not to switch to standard-complaint brower, like FireFox') </script>";
}
?>

blatant plug dont bite me freeware no $$ changes hands
using DevPHP from sourceforge, a php IDE that lets you toggle between the mozilla and IE rendering engines,
code scrap works for me
except:: standard-complaint brower would normally be standard-compliant browser :)

perhaps a rephrasing such as 'pages render better in a compliant browser'

> except:: standard-complaint brower would normally be standard-compliant browser
Oops Spelling mistake

>blatant plug dont bite me freeware no $$ changes hands
using DevPHP from sourceforge, a php IDE that lets you toggle between the mozilla and IE rendering engines,
code scrap works for me

I aint have any idea of what your talking about , i would be glad if you could throw some light on it

It was a plug for a product, DevPHP, in breach of the spirit of DaniWeb\, levity humour, forgetaboutit

the code scrap works for me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.