Detecting Flash With PHP

In my php index script I use headers to send the user to the main page. Works fine. I’d like to add to that and if a user has flash direct them to the flash site theme and if not direct them to an AJAX or HTML theme. How would I go about detecting flash using PHP?

Thanks,

Kain