What is the exact code you're inserting? And where are you inserting it?
If I'm understanding, your "home page" is a secondary site from your UBB site? Is it on the same server? Can site A read the contents of site B? If not, you'll run into permission issues and it'll error out...
Your best bet, is create a php page with the php code on the ubb site, then use a php or ssi include (hell, even an iframe) and include the page on the other site.