Help Needed With Flash 8, PHP, and SQL Database

Okay, this is what I’m looking to do. If you could help with any part of this please let me know. Thank you.

I am looking to make a set-up so when you click on a button in a Flash 8 movie it will use PHP and take the IP address and place it in a SQL database. I want a pop-up to occur in Flash when 1000 clicks have occurred on that one button. The 1000 clicks will be tallied by only allowing the IP to be counted as part of the 1000 clicks every 10 minutes from a built in clock in the flash movie.

If you could help with any part of this please let me know. Thank you.