Hosted solution question - Detecting all registered domains

I recently released a turnkey script (like WordPress) and am now looking to release a hosted solution.

I would like customers to register the domain name themselves. Then, when they sign up w/ my hosted solution, they specify their domain name and point it to my server (through their domain registrar).

i.e. something like this, though preferably simpler…
Using a custom domain name | Tumblr

Then, my service will automatically set up the site under their domain name. I would like all customer domains to point to the same set of script files, so that I will only have to push updates to a single install of the script and it will be reflected across all customer sites/domains.

The script will detect the customer based on the domain and deliver the relevant content.

So my question is…

How do I set up my script or server to detect the customer domains?

Can anyone shed some light on this? If you could provide tutorial links related to this, that would be awesome.