ok, the easiest thing to do is put a .htaccess file in either your root directory or in each folder with this...
PHP:
php_value auto_append_file /home/username/public_html/ad.php
AddType application/x-httpd-php htm
AddType application/x-httpd-php html
then create your ad.php file.
This will make all files with .htm and .html act as if they are .php files.
At the bottom of each page it will include your ad.php file
Just remember that it will add it to your root files (your own files) if you put it under your public_html folder rather than their folders, BUT if it is in their folders and they know how to find it, they could delete it.
change append to prepend to put your file at the top. You can do both which will put your file at the top AND the bottom.