17 Replies Latest reply on Aug 29, 2007 6:06 PM by qoop

    How control multiple users to access same page?

    qoop
      Hi,
      I am working on a public page where the data pull from database base on different UUID. Where this page doesn't required login account. It differential by UUID where it send via email.

      What I affaird in the email that contain UUID that might forward to multiple users for filling in a long forms with same UUID.
      (This form it could be share same department but different sections).

      How can I lock this page or only allow accessing by a user until been submitted?





        • 1. Re: How control multiple users to access same page?
          Level 7
          please clarify your problem - your description is not very clear....

          ---
          Azadi Saryev
          Sabai-dee.com
          http://www.sabai-dee.com
          • 2. Re: How control multiple users to access same page?
            qoop Level 1
            Basically this page is link via url UUID which send by email- which is unique base on Dept ID and it is sending to all dept head's to fill in.

            What I affaird the he/she might forwards this to couple staffs with same Dept ID to fill in - which might be error if someone saved it last will be over write the early saved.

            So i would like to control this page that it only allow 1 user to view the page at a time sometime like lock but i cannot implement with login account as I would like it to be simple and easy.

            Please advise.
            • 3. Re: How control multiple users to access same page?
              BKBK Adobe Community Professional & MVP
              Locks check concurrent actions, two users acting at the same time. What you want is to make it impossible for one user to overwrite the previous efforts of a colleague. So a lock would solve only part of the problem.

              I would record every form submission by ID in the database. When a user opens the form page I would run an initial check to see if a form corresponding to his or her UUID had previously been submitted. I am assuming that you already have a way to validate the UUID beforehand.

              Now, consider the case where two users having the same UUID are concurrently filling the form. It suggests that you should also include code that does a check when the user presses the submit button. It should verify from the database whether a form corresponding to that UUID had already been submitted.

              What about the time wasted by the later user? You will have to ignore such matters, as you want things "to be simple and easy".

              • 4. Re: How control multiple users to access same page?
                qoop Level 1
                Thank BKBK.

                Yes, I hv a code that verify if submitted if will lock n show a message.

                The prob i hv is concurrent filling the form. How can I able to lock this that only allow 1 visitor at a time?
                Any syntax that can do this? CFLOCK able to do the trick?
                • 5. How control multiple users to access same page?
                  BKBK Adobe Community Professional & MVP
                  you could do something like this to prevent concurrent access



                  • 6. Re: How control multiple users to access same page?
                    Nytyme
                    do you have a last modified date on the table being updated?
                    if so, when you pull up the record store the date in a field and check to make sure it's the same when the user runs the update.

                    you can keep track of the first person who enters the site, create a session for that person, and set a timeout so that if they haven't submitted the changes within an hour or so, that it unlocks.
                    • 7. Re: How control multiple users to access same page?
                      qoop Level 1
                      Hi BKBK.
                      I tested but it cannot be lock - i open the dept_id:HR in my pc and I open same dept_id:HR in other pc which able to view same page.

                      ps: dept_id = base on URL.UUID.
                      • 8. Re: How control multiple users to access same page?
                        qoop Level 1
                        Hi Nytyme,
                        I also thought same as u but i would like to try on BKBK's method if doesnt work.. i will using database to control.

                        eg:
                        when user view the page > it write into database with timespan
                        if user refresh/click it update wth new timespan.

                        If current time > timespan with diff IP address then unlock else lock

                        something like this
                        • 9. How control multiple users to access same page?
                          BKBK Adobe Community Professional & MVP
                          Qoop wrote:
                          I tested but it cannot be lock - i open the dept_id:HR in my pc and I open same dept_id:HR in other pc which able to view same page.
                          ps: dept_id = base on URL.UUID.


                          That is a paradox. If entry to the page cannot be locked then the form should not appear on at least one of the PCs. Could we see your code.

                          • 10. How control multiple users to access same page?
                            qoop Level 1
                            sorry for late reply.

                            anyway, here is the code (simplify version), so how do i able to lock base on my code? thanks again.


                            <cfquery of DEPT info base on the #URL.UUID#>


                            <cfif DEPT recordcount EQ 0>
                            Missing dept info <cflocation to xxx.cfm>
                            <cfelse>
                            <cfif SUBMIT EQ 1>
                            TQ for submitting...
                            <cfelse>
                            code start here...
                            <form action= next_page_action.cfm>
                            </cfif>
                            </cfif>
                            • 11. Re: How control multiple users to access same page?
                              Prabhu S
                              Try the above options with your "USE J2EE session varaibles" enabled in the Memory variables of CFMX administrator. It would solve the concurrent issues in terms of sharing the session variables. Try & reply me back.

                              Could u please share the version of your CFMX server ?
                              • 12. Re: How control multiple users to access same page?
                                qoop Level 1
                                Hi Prabhu,
                                I am using CFMX 6 but the server is sharing with other applications.
                                • 13. Re: How control multiple users to access same page?
                                  Prabhu S Level 1
                                  Is there any progress in using the "Use J2EE session variables" ?
                                  • 14. Re: How control multiple users to access same page?
                                    BKBK Adobe Community Professional & MVP
                                    Qoop wrote:
                                    I tested but it cannot be lock - i open the dept_id:HR in my pc and I open same dept_id:HR in other pc which able to view same page.

                                    BKBK wrote:
                                    That is a paradox. If entry to the page cannot be locked then the form should not appear on at least one of the PCs. Could we see your code.

                                    Qoop later wrote:
                                    anyway, here is the code (simplify version)...:
                                    <cfquery of DEPT info base on the #URL.UUID#>

                                    <cfif DEPT recordcount EQ 0>
                                    Missing dept info <cflocation to xxx.cfm>
                                    <cfelse>
                                    <cfif SUBMIT EQ 1>
                                    TQ for submitting...
                                    <cfelse>
                                    code start here...
                                    <form action= next_page_action.cfm>
                                    </cfif>
                                    </cfif>


                                    I have tested my suggestion. It works.

                                    I can see where your code is leading to. However, it does not follow the line I suggested on 08/08/2007. Its logic is essentially different from mine. In my code, the condition for displaying the form is in a lock. In your code, the form is displayed unconditionally.



                                    • 15. How control multiple users to access same page?
                                      qoop Level 1
                                      Hi BKBK,
                                      I understand ur code, which u lock when database recordcount found.

                                      But I need it to be lock not even yet submit to database.. I would like it lock it when someone is viewing the page(dept A form) and no other person able to view dept A form until the person submit and close the page.

                                      Hope this is clear.

                                      ps:
                                      <cflock name="#variables.dept_id#" throwontimeout="Yes" type="readonly" timeout="3">
                                      option 1) I tried to write the dept A in temp database in here if someone is retrieve dept A but then if the person close the browser before submit which the temp database unable to release then it will always lock. Unless i hv to write another code to check every 30 mins to clear the temp database, this help able to release it.

                                      option 2) need to do something here to lock... (still thinking some way)

                                      </cflock>

                                      thanks BKBK.
                                      • 16. How control multiple users to access same page?
                                        BKBK Adobe Community Professional & MVP
                                        Qoop wrote:
                                        But I need it to be lock not even yet submit to database.. I would like it lock it when someone is viewing the page(dept A form) and no other person able to view dept A form until the person submit and close the page.

                                        You may leave out the database code if you want. Try something like:

                                        • 17. Re: How control multiple users to access same page?
                                          qoop Level 1
                                          Hi all,
                                          Sorry for such late reply.

                                          I hv solved the prob.. by combine BKBK and Nytyme methods.
                                          So far, its work prefectly :)

                                          Thanks again guys for all ur great help and advised.