Not much of a tutorial, but here is a script I wrote up for almost the same purpose as you mentioned.
Copy the code and save it in a file, frame.php for example
Change $SETUP[height] to height of top frame in pixels
Change $SETUP[framelocation] to location of your ad frame
Call the script frame.php like so: frame.php?url=http://www.google.com
where url is the url of the page you are calling
See the script in action where I wrote it here.
<?php
$SETUP[height] = "30";
$SETUP[framelocation] = "redirect_frame.html";
?>
<HTML>
<HEAD>
</HEAD>
<FRAMESET FRAMEBORDER="0" ROWS="<?php echo $SETUP[height]; ?>,*">
<FRAME SRC="<?php echo $SETUP[framelocation]; ?>" SCROLLING="NO">
<FRAME SRC="<?php echo $url; ?>">
<NOFRAMES>
<BODY>
Viewing this page requires a browser capable of displaying frames.
</BODY>
</NOFRAMES>
</FRAMESET>
</HTML>
<?php
exit();
?>
Note: You can change any of the features of the frameset... just make sure
<?php echo $url; ?>
is in for the location of the page you are calling