Announcement

Collapse
No announcement yet.

Grrrr.. Cookies!

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

  • #16
    Try it w/o a domain

    Comment


    • #17
      *ahem*
      ARRRRRRRGGGGGGGHHHHHHHHHHH

      Maybe I am doing something wrong... how do you recieve the value of an already set cookie?

      Code:
      echo $cookiename;

      Visual Basic, HTML, PHP, SQL, ASP, JavaScript, C++, Perl

      PHP 4.0.6
      MySQL 3.23.39
      Windows 2000

      Comment


      • #18
        I have tried it without a domain
        Visual Basic, HTML, PHP, SQL, ASP, JavaScript, C++, Perl

        PHP 4.0.6
        MySQL 3.23.39
        Windows 2000

        Comment


        • #19
          Originally posted by Dennis Wrenn
          Maybe I am doing something wrong... how do you recieve the value of an already set cookie?
          echo $cookienamehere;

          BTW: http://www.phpbuilder.com/manual/function.setcookie.php

          Comment


          • #20
            UGGH!
            thats what I tried, but I got nothing!

            maybe it's something in my php.ini
            *checking*
            Visual Basic, HTML, PHP, SQL, ASP, JavaScript, C++, Perl

            PHP 4.0.6
            MySQL 3.23.39
            Windows 2000

            Comment


            • #21
              AAHHHHHHHHHH

              I tried turning output buffering on, then rebooting, and still no luck!!!!!!!
              ARRRRRGHHH!!!


              Code:
              output_buffering	= On
              I have tried everything I can think of.



              Visual Basic, HTML, PHP, SQL, ASP, JavaScript, C++, Perl

              PHP 4.0.6
              MySQL 3.23.39
              Windows 2000

              Comment


              • #22
                I use this to set a cookie:

                header("Set-Cookie: CookieName=CookieValue; expires=" . gmstrftime("%a, %d-%b-%Y %H:%M:%S",time()+31536000) . " GMT; path=/; domain=.programmerstuff.com");

                It will set a cookie named "CookieName" with the value "CookieValue" which expires in one year and only works at the programmerstuff.com domain.

                Comment


                • #23
                  Oh, yeah, and you can access the cookie with $HTTP_COOKIE_VARS['CookieName'] but you can't access it until the user reloads the page or goes to a different page

                  Comment


                  • #24
                    A really quick way to see all the cookies you currently have set is to run a PHPinfo() script from the same directory as you expect the cookie to affect. Use this code:

                    Code:
                    <?php
                    phpinfo();
                    ?>
                    This is the code I use to set cookies:
                    Code:
                    setcookie("MyCookie",$username,mktime(0,0,0,0,0,2020),"/");
                    This is the code I use to retrieve cookies:
                    Code:
                    if (isset($MyCookie)) $myVar = $MyCookie;
                    And this is the code I use to clear cookies:
                    Code:
                    setcookie("MyCookie","",mktime(0,0,0,0,0,1998),"/");
                    Hope this helps.

                    Comment


                    • #25
                      well, that kind of helped..
                      I just downloaded php 4.0.3 and I am able to set cookies,
                      I was not able to with 4.0.1

                      thanks to all of you!!

                      Dennis
                      Visual Basic, HTML, PHP, SQL, ASP, JavaScript, C++, Perl

                      PHP 4.0.6
                      MySQL 3.23.39
                      Windows 2000

                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...
                      X