6 Replies Latest reply on Aug 2, 2009 8:23 PM by zombee

    Website Log!




      I'm creating a flash site, that you can download stuff from, I need a log to know what the people are downloading and when.  I know that I can't simply load the XML log file, add to it and then save it again as this may overwrite an entry that happened during the upload/download of the xml log?


      Any ideas how to do this, or even better are there any components to do this?


      Many Thanks

        • 1. Re: Website Log!
          kglad Adobe Community Professional & MVP

          you can edit xml files using flash.

          • 2. Re: Website Log!
            zombee Level 1

            Please read the question before answer!  Thanks!

            • 3. Re: Website Log!
              kglad Adobe Community Professional & MVP

              is this clear enough for you to understand:


              your orignal post is incorrect.  you can load an xml log, update/edit it in flash and resave it with some server-side scripting.

              • 4. Re: Website Log!
                zombee Level 1



                Yes, I do understand you can do that, however, what happens if two or more people are downloading, and attempt to write the XML file back!  Some data is going to be lost.  Do you understand now?


                To make this clearer,


                Person A decide to download a file, and the site reads the XML to the client machine.

                Person B decides to download a file at that same time and reads the XML file.

                Person A writes the XML back to the server and with the new information in it.

                Person B writes the XML back.

                Oops! XML on persons B machine doesn't have the information from persons A XML so therefore lost.




                Again thank you for the reply.

                • 5. Re: Website Log!
                  zombee Level 1

                  OK! This is my theory to solving this problem I have.


                  I'll have two xml files, the first being the log itself, the second we can call a lock file also xml.


                  The lock file consists of:



                       <file lock="false" />



                  When a person clicks to download a file, the swf downloads the lock file and checks to see if the lock property is false, if it is then it is set to true and sent back, then it can freely download and modify the log, then the lock file is set to false and sent back.


                  If on the other hand the lock property is true, it'll wait an amount of time before loading the lock file again, until the lock file says it is OK to load the XML log.


                  I'll do some tests over then next few days and keep you posted.


                  Many Thanks

                  • 6. Re: Website Log!
                    zombee Level 1

                    Just thought of an even better way of doing it!  Which solves the multi-access to a single file problem.


                    Having not a single log file but one for each user IP, in other words, have a seperate log file for each computer that logs in.


                    If I save the XML as the users IP address and then there is no problem as no one else will have that IP address.


                    OK! Problem solved.