Detect all Browser types PHP
You can use this snippet to detect browser types in PHP and do what you want with them. You might have to moved everything outside of the function to get it to work sometimes.
//get browser info
function get_user_browser()
{
$u_agent = $_SERVER[‘HTTP_USER_AGENT’];
$ub = ”;
if(preg_match(‘/MSIE/i’,$u_agent))
{
$ub = “ie”;
}
elseif(preg_match(‘/Firefox/i’,$u_agent))
{
$ub = “firefox”;
}
elseif(preg_match(‘/Safari/i’,$u_agent))
{
$ub = “safari”;
}
elseif(preg_match(‘/Chrome/i’,$u_agent))
{
$ub = “chrome”;
}
elseif(preg_match(‘/Flock/i’,$u_agent))
{
$ub = “flock”;
}
elseif(preg_match(‘/Opera/i’,$u_agent))
{
$ub = “opera”;
}
return $ub;
}
Then use an if statement to do different things in the different browsers
if($browser == ‘ie’){ $output .= $flash_top; } else { $output; }