I would suggest using that plugin, but slightly modifying it for your needs. For example, you can find the code block in php-browser-detection.php that does the IE7 check:
function is_IE7 (){
$browserInfo = php_browser_info();
if(isset($browserInfo['browser']) && $browserInfo['browser']=='IE' && $browserInfo['majorver'] == '7')
return true;
return false;
}
To create a version that will detect IE 8, add a new function that does the same thing, but just with the majorver set to 8:
function is_IE8 (){
$browserInfo = php_browser_info();
if(isset($browserInfo['browser']) && $browserInfo['browser']=='IE' && $browserInfo['majorver'] == '8')
return true;
return false;
}