Thanks all for your help.
However, I have found a way to do this that will be more precise as to which browser is using and display to them what browser they are using.
Just incase anyone fancies using this script here is the code.
<!----------------------------------------------------------------------------------->
In a file called browsercheck.php in the folder script put this code
<?php
//--------------------------------------------------------
//
// This script checks to see if the user's browser is either IE5.5 or 6.0, Safari 2 or 1, Firefox 1.
// This will then put a yellow bar at the top of the users page to notify them that the website may not function correctly
// Use this code right after the body of the site
//
// if ($oldbrowser == 'yes') {
// (((div tags go here)))
// }
//
//--------------------------------------------------------
// This code finds the root of the server
$ServerRoot = $_SERVER["DOCUMENT_ROOT"];
// This code finds the user agent the user is uing
$browser = $_SERVER['HTTP_USER_AGENT'];
//Trying to find word IE5.5 if exists, then it is IE
if (preg_match("/MSIE 5.5/", $browser)) {
$browser = "Internet Explorer";
$version = "5.5";
$oldbrowser = "yes";
$browserversion = "Internet Explorer 5.5";
}
//Trying to find word IE6.0 if exists, then it is IE
if (preg_match("/MSIE 6.0/", $browser)) {
$browser = "Internet Explorer";
$version = "6.0";
$oldbrowser = "yes";
$browserversion = "Internet Explorer 6.0";
}
//Trying to find word 1.0 Safari if exists, then it is IE
if (preg_match("/Safari\/3/", $browser)) {
$browser = "Safari";
$version = "2";
$oldbrowser = "yes";
$browserversion = "Safari 2";
}
//Trying to find word Safari/419 if exists, then it is IE
if (preg_match("/Safari\/1/", $browser)) {
$browser = "Safari";
$version = "1";
$oldbrowser = "yes";
$browserversion = "Safari 1";
}
//Trying to find word Safari/419 if exists, then it is IE
if (preg_match("/Firefox\/1/", $browser)) {
$browser = "Firefox";
$version = "1";
$oldbrowser = "yes";
$browserversion = "Firefox 1";
}
?>
<?php
if ($oldbrowser == 'yes') {
include($ServerRoot."/script/browsercheck_text.php");
}
?>
<------------------------------------------------------------------------------------>
<!----------------------------------------------------------------------------------->
In a file called browsercheck_text.php in the folder script put this code (or any other text you want to use (the image file does not work, but it is just a warning symbol))
<style type="text/css">
#OldBrowser {
background-color: #FFFF66;
padding: 10px;
width: 90%;
border: 1px solid #CCCCCC;
color: #333333;
margin-right: auto;
margin-left: auto;
font-size: 1.3em;
}
#OldBrowser img {
float: left;
margin-right: 10px;
}
</style>
<div id="OldBrowser"><img src="<?php $ServerRoot ?>/images/symbols/warning35.jpg" width="41" height="34" />We have detected that your browser is <?php echo $browser ?> <?php echo $version ?>. This site has not been fully tested on your browser and some functions may not work correctly.<br />
To make the most of this site and benefit from the security and functionality of the new browsers, we recommend upgrading to the new <?php echo $browser ?> browser.</div>
<------------------------------------------------------------------------------------>
<!----------------------------------------------------------------------------------->
Then in the main file e.g. a template put this code
<?php
$ServerRoot = $_SERVER["DOCUMENT_ROOT"];
include($ServerRoot."/script/browsercheck.php");
?>
<------------------------------------------------------------------------------------>
Hope this script helps anyone
Carl