Announcement

Collapse
No announcement yet.

Cookie Puzzle

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Cookie Puzzle

    Good morning.

    Please don't laugh but I am still using Miva and Miva Mia for my local server. Never quite got round to catching up with the 21st Century and probably too old now to bother.

    I have a couple of sites using Miva and they have been working fine for many years but sometime in the past year it seems that they have not been writing or reading cookies.

    Strange thing is that cookies get read and written no problem if I use IE9 and Firefox but not if I use Chrome or Opera.

    Has anybody any ideas?

    Thanks in advance

    #2
    Can you post a link to your website? (FYI - your first 3 posts are moderated, that's why they didn't appear)
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    Comment


      #3
      Ah - that explains it.

      There is a test page at

      http://keepactive.net/scripts/test_cookie.html

      If cookies are working then the count should increment with each page refresh.

      Thanks for your interest.

      Comment


        #4
        I haven't approved your follow-on post since it doesn't appear to be a link to a Miva Merchant website.
        Leslie Kirk
        Miva Certified Developer
        Miva Merchant Specialist since 1997
        Previously of Webs Your Way
        (aka Leslie Nord leslienord)

        Email me: [email protected]
        www.lesliekirk.com

        Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

        Comment


          #5
          You are right..

          I realised after posting to this area that the correct choice would be
          so I posted there as I am using MIvsScript

          I assume that posting is waiting to be moderated.





          Comment


            #6
            This is because using a Meta tag to create a cookie has been deprecated in M63, and completely removed in M65 versions of chrome. You should use javascript or create a "Create_Cookie" feature using Miva_Output_Headers() function as Miva Merchant does in the following function:

            [code]
            <MvFUNCTION NAME = "OutputCookies" PARAMETERS = "cookies var" STANDARDOUTPUTLEVEL = "">
            <MvASSIGN NAME = "l.set_cookie_header" VALUE = "">
            <MvASSIGN NAME = "l.cookie_pos" VALUE = 1>
            <MvASSIGN NAME = "l.cookie_count" VALUE = "{ StructureMembers( l.cookies, l.cookie_names ) }">

            <MvWHILE EXPR = "{ l.cookie_pos LE l.cookie_count }">
            <MvREFERENCEARRAY NAME = "l.cookie" VARIABLE = "l.cookies">
            <MvMEMBER NAME = "{ l.cookie_names[ l.cookie_pos ] }">
            </MvREFERENCEARRAY>

            <MvIF EXPR = "{ len( l.cookie:value ) OR l.cookie:expires }">
            <MvIF EXPR = "{ len( l.set_cookie_header ) }">
            <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ asciichar( 13 ) $ asciichar( 10 ) $ 'Set-Cookie: ' }">
            </MvIF>

            <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ l.cookie:name $ '=' $ l.cookie:value }">

            <MvIF EXPR = "{ len( l.cookie:domain ) }"> <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ '; domain=' $ l.cookie:domain }"> </MvIF>
            <MvIF EXPR = "{ len( l.cookie:expires ) }">
            <MvIF EXPR = "{ isdigit( l.cookie:expires ) }"> <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ '; expires=' $ Format_RFC1123_DateTime( l.cookie:expires ) }">
            <MvELSE> <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ '; expires=' $ l.cookie:expires }">
            </MvIF>
            </MvIF>
            <MvIF EXPR = "{ len( l.cookie:path ) }"> <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ '; path=' $ l.cookie:path }"> </MvIF>
            <MvIF EXPR = "{ l.cookie:secure }"> <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ '; secure' }"> </MvIF>
            <MvIF EXPR = "{ l.cookie:httponly }"> <MvASSIGN NAME = "l.set_cookie_header" VALUE = "{ l.set_cookie_header $ '; HttpOnly' }"> </MvIF>
            </MvIF>

            <MvASSIGN NAME = "l.cookie_pos" VALUE = "{ l.cookie_pos + 1 }">
            </MvWHILE>

            <MvIF EXPR = "{ ISNULL l.set_cookie_header }">
            <MvFUNCTIONRETURN VALUE = 0>
            </MvIF>

            <MvFUNCTIONRETURN VALUE = "{ miva_output_header( 'Set-Cookie', l.set_cookie_header ) }">
            </MvFUNCTION>
            </code]
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


              #7
              Bruce - many thanks for the information.

              In spite of much Googling I had not seen anything about this change.

              I looked at your code but my version of Miva is so old it is just not up to the job!

              I searched around and came across this bit of Javascript which does the job nicely;

              <script>document.cookie="c1=99"</script>

              I can replace the c1 value using Miva and I can then read the cookie using a function in my version of Miva and the cookie value is then available to my script.

              It is probably a crude solution but hey, it works!

              Again, thank you for taking the time.

              Regards

              John Tuach

              Comment


                #8
                javascript is fine. the advantage to using the mivascript version is that cookie data is now available as a mivascript global variable.
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment

                Working...
                X