Website advert scripts?

I’m building out a site that is planning to sell advertising space. The aim is to sell the space individually direct to advertisers, not just add the usual ad services. I’d like to use a script that manages the entire process and allows the client to add and manage their adverts. The script will need to be able to handle costs based on impressions, clicks and so on.

Normally, for scripts, I turn to PHPjabbers, but they don’t seem to have anything. So I’m looking for recommendations.