You can use the auto_append_file and auto_prepend_file directives in PHP. Then you can reassociate .html and .htm files as PHP files in your httpd.conf, and they PHP will be inserted before and after any HTML document. They only problem is your scripts my cause interference with scripts the user is attempting to use. For instance, if they use setcookie() and your prepend script prints something to the page, they're out of luck.
Former owner of A Small Orange New owner of <COMING SOON>