Forgive me, as I don't know how phpchat is setup, but if they have template files (like web forums, then it'll go in there, but if there's only an index.php, then look within the code for the proper place you would like to place it, and use
PHP:
echo "ad script goes here. escape your \"quotes\" or you will get an error 'apostrophes' are okay aslong as you do not start the echo with 'apostrophes' :)";