You dont need edit any file!
You only need to edit board wrapper!
Login to admin cp go to Skins & Templates > Skin Manager > (click skin on wich you want place ads) Edit Root Skin Board Header & Footer Wrapper
And add ADS code where you like (example after %copyright%)
The operation is fully revertable.
To restore old wrapper:
Skins & Templates > Skin Manager > (click skin on wich you want place ads) Revert All Skin Customizations...
The process is same for Invision Power Board 1 and phpBB forums.