Project Description:
I need some help with Flash, PHP and MySQL.
Part 1:
For activation and registration of a swf file on a MySQL database I need a working sample with PHP and Flash (if possible in AS 3) scripts.
The Flash file must have a textfield and a button. If I put a number into the field and click on the button, the PHP script must check the MySQL table if the value from the textfield is in the table or not and send the result (true or false) back to the flash file. It is true the value is to be stored in a "sharedobject".
Part 2:
I would like to prevent, that several files with the same number are active at the same time. For checking this I need another working sample.
When I open the Flash file, the AS script sends the number and a timestamp to the PHP script. The PHP must check, if the number is in the MySQL table.If is true, the script gives a value like "false" (because the swf is active) back to Flash.
If the number is not in the table, the PHP script must create a new record with the number, timestamp, Ip-adress and a empty status field and send a value like "true" back to flash. Now the Flash file sends every 10 minutes, starting from timestamp (with new Timer class) a value like "active" to PHP. PHP writes this value in the status field.
Another PHP script checks every 11 minutes, starting from timestamp, if the status field is "active". If not the script deletes the record.
I hope you understands my goal. The flash part is no problem, but the PHP and MySQL stuff is new for me. I know, that there are a lot of similar login scripts in the web, but I don't feel like to experiment. All code must come with documentation.
Other ideas for an easy and secure workaround are welcome.