Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 17 Feb 2010, 17:11
gamerfu's Avatar
gamerfu gamerfu is offline
 
Join Date: Apr 2008
Location: 台灣,&
Real name: 海富富
PHP check for IE

How do I check for IE 6 and older browsers in PHP?

The function I want to run is anything older than IE6 should run other images, if anything newer or any other browser display PNGs:

$useragent = $_SERVER[‘HTTP_USER_AGENT’]);

if (preg_match(‘|MSIE ([0-6].[0-9]{1,2})|’,$useragent,$matched))
{
$browser_version=$matched[1];
$browser = ‘IE’;
$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
}

else
{
$extList['png'] = 'image/png';
}

Last edited by gamerfu : 17 Feb 2010 at 17:22.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 05:52.

Layout Options | Width: Wide Color: