Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

US Job listings




   Misc

   Amazon

   Links

    


User Agent

 

With the much improved Mozilla Firebird and numerous there may still be a case for checking for Internet Explorer or Mozilla. This example was tested successfully with Internet Explorer 6 and Mozilla Firebird.

 

 

<?php
$useragent = getenv("HTTP_USER_AGENT");

if (preg_match("/MSIE/i", "$useragent"))
{
$result = "Internet Explorer.";
}

else if (preg_match("/Mozilla/i", "$useragent"))
{
$result = "Mozilla";
}

else
{
$result = "You are using $useragent";
}
?>
<HTML>
<HEAD>
<TITLE>Browser Match Results</TITLE>
</HEAD>
<BODY>
<?php echo "<P>$result</P>"; ?>
</BODY>
</HTML>

The result can be seen here


 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
List all files in a directory(VBnet)
change windows color scheme(VB)
World population(PHP)
Delete a file(VB)
display the day of the week(VB)
app does not appear in ctrl + alt + delete applications list(VB)
Yahoo news(PHP)
capitalize letters(CSS)

    




Copyright © 2004 by programmershelp.co.uk