Can anyone please suggest a decent self-hosted ad-serving script.

I've been using OpenAds but it recently won't let me login.

Of course I prefer free open source, but am happy to pay for somehting appropriate.