IMHO, the best solution would be to use a third party ad manager such as PHPAdsNew to handle all your ad rotating and insertion. You'd just copy PHPAdsNew's inclusion script into UBB's Content Islands.

PHPAdsNew is a very robust, professional grade, ad manager and adds many features such as allowing you to easily update an ad's code across multiple sites, changing which ads are displayed and when. e.g. have some ads appear only at certain days and/or times, to certain IP ranges (US visitors only), only show an ad to a user x many times in x many minutes, etc. Best of all its free.