Hi, and welcome to the forum billo. I'm a little unsure on how it might not be legal to insert the code in to the header template? I'd be interested to read more about that if you have a link.
I have used AdSense on phpBB v2 before and although it depends a little on the skin you are using, I was able to insert the code in to the file:
templates/<your_template>/index_body.tplat the very top of this file. So I placed something like this in the very top of that file:
<table width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<td width=100% align=center>
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
.
.
.
.
.
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>
That would give me a 728x90 ad block below the header of every page.