10 Replies Latest reply on Mar 13, 2009 11:58 AM by Joseph07888

    SESSION NOT LOOPING IN RECORDSET - PLS HELP

    Joseph07888
      Hi All,

      Please please will someone help me with this problem....

      I am building a simple internal email contact system where members can send a message to another member via their profile.

      The inbox messages are listed with buttons (READ - REPLY - DELETE - REPORT SPAM)

      1. The recordset displays the correct data within the repeat region

      e.g. From - subject - date received

      but when you come to click any of the "READ - REPLY - DELETE - REPORT SPAM" buttons (no matter which message you select) it always select the first record from the database even though the RS in displaying correctly.

      CODE ***********************************************************

      Inbox RS & SESSION Code

      SELECT ms_memberinbox.SubjectInboxMes, ms_memberinbox.DateInboxMes, ms_memberinbox.id_InboxMes, ms_memberinbox.idUserFromInboxMes, tbl_users.CompanyName
      FROM ms_memberinbox Inner Join tbl_users ON ms_memberinbox.idUserFromInboxMes = tbl_users.id_user
      WHERE IDM = idUserFromInboxMes

      (SESSION VAR)
      $_SESSION["MMID"] = $row_rsMemMesInbox['id_InboxMes'];

      $id_InboxMes = $_SESSION['MMID'];

      Button link to read.php page

      read.php?IDM=&MMID=

      READ MESSAGES RS & SESSION CODE

      SELECT ms_memberinbox.SubjectInboxMes, ms_memberinbox.DateInboxMes, ms_memberinbox.id_InboxMes, ms_memberinbox.idUserFromInboxMes, tbl_users.CompanyName, ms_memberinbox.MessageInboxMes
      FROM ms_memberinbox Inner Join tbl_users ON ms_memberinbox.idUserFromInboxMes = tbl_users.id_user
      WHERE IDM = ms_memberinbox.idUserFromInboxMes AND MMID = id_InboxMes

      IDM = $_SESSION['kt_login_id']

      MMID = $_SESSION['MMID']

      CODE END ***************************************************************

      I dont want to simply pass it via URL as it could make it unsecure but I don't know what else to do.

      Again please help.

      Regards,
      Joe
        • 1. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
          Günter Schenk Level 4
          Hi Joe,

          I wonder if this:

          WHERE IDM = ms_memberinbox.idUserFromInboxMes AND MMID = id_InboxMes

          wouldn´t have to be simply the other way round, means:

          WHERE ms_memberinbox.idUserFromInboxMes [equals the session variable kt_login_id] AND ms_memberinbox.id_InboxMes [equals the session variable MMID]

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
            Joseph07888 Level 1
            Hi Gunter,

            sorry but computer says NO...

            The problem refers to the inbox.php page where the RS of just listing the user results by date order and the

            ms_memberinbox.id_InboxMes [equals the session variable MMID]

            is not at this stage in use.

            Once clicking the "READ" button this takes you to the read.php page where the session MMID whould be passed.

            But as I say on the inbox.php page it repeats the data but not the URL session variable ID.

            e.g.

            From: Gunter Subject: SESSION NOT LOOPING Date: 2009-03-06 = ID 1(ONE)

            From: Joseph Subject: Re:SESSION NOT LOOPING Date: 2009-03-06 = ID 1(ONE)& not 2 (TWO)

            I would be happy to send you the more information if that helps but i am at this stage i really don't know what to do.

            If I pass it via URL then it is unsecure.

            It dose pass vis session but no matter which record (Email) you select it still only shows you the first record in the repeat region.

            I already owe you a beer from ages ago if we can get this going for me it will really mean ill have to sort you out with a few beers via what ever delivery poss.

            Cheers,
            Joe
            • 3. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
              Günter Schenk Level 4
              Hi Joe,

              ------
              But as I say on the inbox.php page it repeats the data but not the URL session variable ID
              ------

              such things require to having a look at the complete inbox.php code -- preferably uploaded as .txt file on your server and not posted in these forums, because the current adobeforums usually mess posted code pretty much up when it contains HTML markup.

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
                Joseph07888 Level 1
                Hi Gunter,

                Thank you again for looking at this for me and you can find the files at the below URLs.

                entrepreneurnetworks.co.uk/inbox.txt

                entrepreneurnetworks.co.uk/read.txt

                I will keep my fingers, arms, legs, and toes crossed you find the problem or help to understand the next steps.

                Cheers,
                Joe
                • 5. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
                  Günter Schenk Level 4
                  Joe,

                  only talking about the issue with inbox.php now:

                  this here:

                  // SESSION TO PASS TO READ.PHP PAGE
                  $_SESSION["MMID"] = $row_rsMemMesInbox['id_InboxMes'];

                  ...will by nature only be able to "echo" the very first record that´s returned from the MemMesInbox recordset, because it - unline the repeat region you defined in the document´s body - does not loop through the recordset.

                  In this context I don´t really think it would make sense to try turning $row_rsMemMesInbox['id_InboxMes'] into a session variable at all -- it´s clear that you´ll need to pass the related value via the URL variable MMID, but then again you could pass $row_rsMemMesInbox['id_InboxMes'] as such.

                  What kind of value does "id_InboxMes" actually contain ?

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
                    Joseph07888 Level 1
                    Hi Gunter,

                    it contains the email message id value for an internal message sent between registered members.

                    Each record will represent a new message whether that be a new message or reply to orginal message.

                    The messaging system in based on the Forum tutorial from ages ago but the concept is quite similar except each user can only return their own emails and they are not public.

                    So when a member clicks on their inbox link it will display a list of messages sent to them, in a repeating row like below.

                    From: Gunter Subject: SESSION NOT LOOPING Date: 2009-03-06 = ID 1(ONE)
                    BUTTON OPTIONS-> (READ - REPLY - DELETE - REPORT SPAM)

                    From: Joseph Subject: Re:SESSION NOT LOOPING Date: 2009-03-06 = ID 1(ONE)& not 2 (TWO)
                    BUTTON OPTIONS-> (READ - REPLY - DELETE - REPORT SPAM)

                    If i pass it by URL then it becomes unsecure as i could change the id ref to "3" and read your message. "Or am I missing something"

                    Cheers,
                    Joe
                    • 7. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
                      Günter Schenk Level 4
                      Hi Joe,

                      ------
                      If i pass it by URL then it becomes unsecure as i could change the id ref to "3" and read your message.
                      ------

                      that´s correct, but even if it would work, trying to pass the corresponding Session Variable via URL bears the very same risk -- and as this can´t work, because the Session Variable you declared sits outside the "loop" and can´t be integrated in here, you can use the corresponding recordset value rightaway.

                      It´s clear that you indeed will have to pass some value via URL in this case, but Session Variables only make sense if they´re not passed via URL.

                      -------
                      "Or am I missing something"
                      -------

                      the page where to check the passed id´s "ownership" is your "read.php", and it´s an ideal page because it just displays one record.

                      Usually this is done by adding an extra "authentication" recordset which...

                      1. checks if the "ownership_column" of the currently displayed record equals the Session Variable kt_login_id

                      2. if both values match, display the message, but if not, display an alternate "you´re not authorized..." message. This can be done using ADDT´s Show If Conditional behaviour

                      Cheers,
                      Günter Schenk
                      Adobe Community Expert, Dreamweaver
                      • 8. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
                        Joseph07888 Level 1
                        Hi Gunter,

                        Your are totally correct and did not think of using "Show If Con" to check.

                        I will get on the case of this and try it out and let you know the out come.

                        All been well you will need to let me know some details so we can get this beer delivered to say thank you for your continued help.

                        Talk to you soon

                        Cheers,
                        Joe
                        • 9. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
                          Günter Schenk Level 4
                          Hi Joe,

                          -------
                          All been well you will need to let me know some details so we can get this beer delivered to say thank you for your continued help
                          -------

                          thanks for this generous offer, but getting such a nice appreciation is already more than one could ask for ;-)

                          Well, if you really insist on donating some beer -- why not send it to your local Alcoholics Anonymous group instead ? :-)

                          Cheers,
                          Günter Schenk
                          Adobe Community Expert, Dreamweaver
                          • 10. Re: SESSION NOT LOOPING IN RECORDSET - PLS HELP
                            Joseph07888 Level 1
                            Hi Gunter,

                            Sorry for the delay it has been a very busy week!!!

                            Following on from our above messages I have tested and tested what you suggested and it works.

                            The only this I feel I am missing (or not fully understanding) is

                            ______

                            Usually this is done by adding an extra "authentication" recordset which...

                            1. checks if the "ownership_column" of the currently displayed record equals the Session Variable kt_login_id

                            2. if both values match, display the message, but if not, display an alternate "you´re not authorized..." message. This can be done using ADDT´s Show If Conditional behaviour

                            _______

                            I have it working where if you should enter someone elses email ID (E.g. 3) then it will just say sorry your not auth to view this message.

                            But if you are the same user you can change the MMID to one of your own and display that messasge.

                            Have I missed something wrong along the line or is that correct based on your (SUPERSTAR EXPERT) suggestion?

                            The AA group thanked me ever so much for dropping wiht the donation and we sung merry songs, but they did insist that "This person in germany should receive some sort of thank you" so I am thinking of somthing and will let you know.

                            But is that what it should do or not?

                            If yes I am thinking of adding a "Next Message" link to move to the next message in line for that user...

                            Again Gunter your a star!!!

                            Cheers,
                            Joe