I know this is an old thread, but that guys question never got answered because everyone had a logic error.. lol, I've encountered this before, it's kinda a mind-bender, anyhow, here's the proper line of code:
PHP Code:
if ($maxattachsize!=0 and $filesize>$maxattachsize and ($bbuserinfo[usergroupid]!=6 and $bbuserinfo[usergroupid]!=5) {
It's not OR between the groups, it's AND..

Sit down and think about it...