The conclusion is: they are using the phpads software. You can find here: http://phpadsnew.com/
But you can use any other ads management software.
You can see here how inlude php files in templates: http://www.ez.no/ez_publish/documentation/customization/tips_tricks/including_php_files_in_templates