Understanding Cookies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    Understanding Cookies

    Hello,
    I have been trying to get cookies to work. It seems I can get this cookie to
    be persistant in the browser but I want to write it to my Cookies Folder.
    I have tried many variations but when I look in the folder there is nothing
    there from my Domain.
    This is a simlified version but, I have tried many things.
    What am I missing?
    Yes I allow all cookies
    Thanks
    Mike


  • Andy Hassall

    #2
    Re: Understanding Cookies

    On Tue, 08 Nov 2005 01:17:09 GMT, "Mike" <ampeloso@veriz on.net> wrote:
    [color=blue]
    >I have been trying to get cookies to work. It seems I can get this cookie to
    >be persistant in the browser but I want to write it to my Cookies Folder.
    >I have tried many variations but when I look in the folder there is nothing
    >there from my Domain.
    >This is a simlified version but, I have tried many things.[/color]

    What have you tried?

    Presumably you have read and followed the examples at
    http://uk.php.net/setcookie ?
    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Mike

      #3
      Re: Understanding Cookies

      Yes,
      Heres a perfect example;
      <?php
      $value = 'something from somewhere';
      setcookie("Test Cookie", $value, time()+3600); /* expire in 1 hour */
      ?>
      Can be found at:(My Domain)


      I leave the browser open and check my Cookies folder and ...Nothing .
      Thanks
      Mike

      "Andy Hassall" <andy@andyh.co. uk> wrote in message
      news:4k00n19af9 ci53k1a1adiu2me b615ddbsn@4ax.c om...[color=blue]
      > On Tue, 08 Nov 2005 01:17:09 GMT, "Mike" <ampeloso@veriz on.net> wrote:
      >[color=green]
      >>I have been trying to get cookies to work. It seems I can get this cookie
      >>to
      >>be persistant in the browser but I want to write it to my Cookies Folder.
      >>I have tried many variations but when I look in the folder there is
      >>nothing
      >>there from my Domain.
      >>This is a simlified version but, I have tried many things.[/color]
      >
      > What have you tried?
      >
      > Presumably you have read and followed the examples at
      > http://uk.php.net/setcookie ?
      > --
      > Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
      > http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool[/color]


      Comment

      • Andy Hassall

        #4
        Re: Understanding Cookies

        On Tue, 08 Nov 2005 01:51:47 GMT, "Mike" <ampeloso@veriz on.net> wrote:
        [color=blue]
        >Heres a perfect example;
        ><?php
        >$value = 'something from somewhere';
        >setcookie("Tes tCookie", $value, time()+3600); /* expire in 1 hour */
        >?>
        >Can be found at:(My Domain)
        >http://www.ampsoft.com/B.php
        >
        >I leave the browser open and check my Cookies folder and ...Nothing .[/color]

        That works for me, both on Firefox 1.5RC1 and Internet Explorer 6.

        A cookie is set and stored; contents of the file from IE is:

        TestCookie
        something+from+ somewhere
        perbedaan host dan server yaitu email hosting profesional firewall canggih email hosting web hosting terbaik FTP access aman SSL gratis SSL gratis hosting firewall canggih CDN VPS hosting uptime tinggi 99.9% FTP access load balancing handal bandwidth unlimited cepat

        1024
        3124430464
        29746191
        1793278832
        29746183
        *

        Add the following:

        print "<pre>";
        var_dump($_COOK IE);
        print "</pre>";

        Then you will be able to see what cookies the browser has accepted and sent
        back.

        If you're not getting anything, then you have a browser configuration problem.
        --
        Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
        http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

        Comment

        • Mike

          #5
          Re: Understanding Cookies

          I'm getting:array(0 ) {
          }
          "Andy Hassall" <andy@andyh.co. uk> wrote in message
          news:4d10n1lmmd 3agkvv8ds24olqp 1slgev4u0@4ax.c om...[color=blue]
          > On Tue, 08 Nov 2005 01:51:47 GMT, "Mike" <ampeloso@veriz on.net> wrote:
          >[color=green]
          >>Heres a perfect example;
          >><?php
          >>$value = 'something from somewhere';
          >>setcookie("Te stCookie", $value, time()+3600); /* expire in 1 hour */
          >>?>
          >>Can be found at:(My Domain)
          >>http://www.ampsoft.com/B.php
          >>
          >>I leave the browser open and check my Cookies folder and ...Nothing .[/color]
          >
          > That works for me, both on Firefox 1.5RC1 and Internet Explorer 6.
          >
          > A cookie is set and stored; contents of the file from IE is:
          >
          > TestCookie
          > something+from+ somewhere
          > www.ampsoft.com/
          > 1024
          > 3124430464
          > 29746191
          > 1793278832
          > 29746183
          > *
          >
          > Add the following:
          >
          > print "<pre>";
          > var_dump($_COOK IE);
          > print "</pre>";
          >
          > Then you will be able to see what cookies the browser has accepted and
          > sent
          > back.
          >
          > If you're not getting anything, then you have a browser configuration
          > problem.
          > --
          > Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
          > http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool[/color]


          Comment

          • Geoff Berrow

            #6
            Re: Understanding Cookies

            Message-ID: <F%Tbf.4061$SV1 .3415@trndny01> from Mike contained the
            following:
            [color=blue]
            >I'm getting:array(0 ) {
            >}[/color]

            Try refreshing it.

            --
            Geoff Berrow (put thecat out to email)
            It's only Usenet, no one dies.
            My opinions, not the committee's, mine.
            Simple RFDs http://www.ckdog.co.uk/rfdmaker/

            Comment

            • ampeloso@gmail.com

              #7
              Re: Understanding Cookies

              It seems to me that the cookie wont store on the client if there is no
              expiration time,which contradicts the Documentation which says if there
              is no exp. time it lasts until the browser closes.

              Comment

              • Kim André Akerø

                #8
                Re: Understanding Cookies

                ampeloso@gmail. com wrote:
                [color=blue]
                > It seems to me that the cookie wont store on the client if there is no
                > expiration time,which contradicts the Documentation which says if
                > there is no exp. time it lasts until the browser closes.[/color]

                They /are/ stored on the client computer. You just need to read *all*
                of the manual page:

                <quote>
                Once the cookies have been set, they can be accessed on the next page
                load with the $_COOKIE or $HTTP_COOKIE_VA RS arrays.
                </quote>

                (Just below the table where the parameters are explained in detail.)

                --
                Kim André Akerø
                - kimandre@NOSPAM betadome.com
                (remove NOSPAM to contact me directly)

                Comment

                • ampeloso@gmail.com

                  #9
                  Re: Understanding Cookies

                  Yes, But they are not written to the Cookies folder unless there is an
                  expiration time.I tried this several times.
                  Run http://www.ampsoft.com/Doesnt.php
                  Refresh as much as you want---No cookie written to disk(Cookies Folder)
                  Run http://www.ampsoft.com/Does.php
                  Refresh - a cookie is written.

                  Doesnt:
                  <?php
                  $value = 'This cookie doesnt write';
                  setcookie("Test Cookie", $value);
                  ?>

                  Does:
                  <?php
                  $value = 'This cookie writes';
                  setcookie("Test Cookie", $value,time()+3 600); /* expire in 1 hour */
                  ?>

                  Comment

                  • Kim André Akerø

                    #10
                    Re: Understanding Cookies

                    ampeloso@gmail. com wrote:
                    [color=blue]
                    > Yes, But they are not written to the Cookies folder unless there is an
                    > expiration time.I tried this several times.
                    > Run http://www.ampsoft.com/Doesnt.php
                    > Refresh as much as you want---No cookie written to disk(Cookies
                    > Folder) Run http://www.ampsoft.com/Does.php
                    > Refresh - a cookie is written.
                    >
                    > Doesnt:
                    > <?php
                    > $value = 'This cookie doesnt write';
                    > setcookie("Test Cookie", $value);
                    > ?>[/color]

                    It did, and I'm using Opera 8.5. Although it doesn't have a cookies
                    "folder", it does allow me to access all cookies set for all domains.

                    For the "expire" parameter of setcookie():
                    "If not set, the cookie will expire at the end of the session (when the
                    browser closes)."
                    [color=blue]
                    > Does:
                    > <?php
                    > $value = 'This cookie writes';
                    > setcookie("Test Cookie", $value,time()+3 600); /* expire in 1 hour */
                    > ?>[/color]

                    --
                    Kim André Akerø
                    - kimandre@NOSPAM betadome.com
                    (remove NOSPAM to contact me directly)

                    Comment

                    • Andy Hassall

                      #11
                      Re: Understanding Cookies

                      On 8 Nov 2005 10:55:38 -0800, ampeloso@gmail. com wrote:
                      [color=blue]
                      >Yes, But they are not written to the Cookies folder unless there is an
                      >expiration time.[/color]

                      If there is no expiration time, then the cookie is valid until the browser
                      window is closed.

                      So, why should the browser bother writing it to disk when it can just keep it
                      in the area of memory associated with that browser window?
                      --
                      Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
                      http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

                      Comment

                      • ampeloso@gmail.com

                        #12
                        Re: Understanding Cookies

                        I'm using IE and there is definitly a difference
                        Anybody out there with IE, let me know, Please
                        ampeloso@verizo n.net
                        Thanks
                        Mike

                        Comment

                        • windandwaves

                          #13
                          Re: Understanding Cookies

                          ampeloso@gmail. com wrote:[color=blue]
                          > I'm using IE and there is definitly a difference
                          > Anybody out there with IE, let me know, Please
                          > ampeloso@verizo n.net
                          > Thanks
                          > Mike[/color]

                          I dont doubt that it is not working for you, but to say that it does not
                          work would be out of the question, because 1000s of people around the world
                          are using this method very successfully. There must be something else that
                          is wrong, e.g.

                          - php not installed correctly
                          - caching problem
                          - etc...



                          Comment

                          Working...