I am running Windows XP Pro, Apache, MySQL and PHP. I can set a cookie but when I try to read it, it’s not there. It all worked well until a few days ago. I do not remember making any changes to XP or anything else.

I have two PCs. Running my programs live, on my development PC the cookie disappears or never gets set. On my other PC the cookie is there. Running them in the test mode (localhost) I can read the cookie as well. My AVG Firewall is turned off. Windows is set to “Accept all Cookies” and POP-ups are blocked. Still no luck. Any clues?

    What browser are you using? Have you tried just a simple cookie script to see if it works? Something simple from the php site like:

    <?php
    $value = 'something from somewhere';
    
    setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
    
    echo $_COOKIE["TestCookie"];
    ?>

      Note that The-Master's code above will not output anything at all the first time you visit the page.

      Perhaps you should show us how you're setting cookies in the code that isn't working?

        the code is simple enough - I think:

        (array)$line;
        $line[0] = $LoginID;
        $line[1] = $SchoolNbr;
        $cookieData = implode("|", $line);
        
        setcookie('dmv_cookie', $cookieData, time() +3600);
        header("Location: schollPm3RqwT.php");

        Now remember, I said it worked well a few days ago, it works on my other computer and I just checked it in the local Library and it works there as well. But not on my main development PC - any longer.

          What browser are you using on your development PC? Have you double checked cookie settings in that browser and/or tried a different browser?

          Also, double check the date and time on both the server and your computer - ensure that they are set somewhat accurately.

            Brilliant idea. Thanks a million!

            I am running Explorer 6. I just ran my sripts using FireFox and Navigator 9 and guess what? It works. No problems!

            Do you have any idea on how to repair Explorer?

              Check your privacy settings (Tools -> Internet Options -> Privacy tab) - what are they set to?

              Also, when viewing your website in IE, do you see an icon in the lower-left hand corner of the window of a red circle and a white minus sign inside it? If so, double-click on that and you should be able to allow your website to store cookies on your computer.

                I have deleted all cookies. My Tools/Internet Options/Privacy is set to "allow all cookies". I do not have anything showing in the lower left hand corner except the Explorer icon and "Done" 😕

                  Er, I mean lower-right hand corner, sorry. You could also try specifically adding your website in the Privacy tab as "Allowed" (on the sites tab).

                  If nothing else, you could rejoice in the loss of IE and switch to a better browser instead :p

                    Nothing in ANY corner. I added the site to the Privacy tab as allowed. No change.

                    A better browser? I seem to have some other problems with that.

                    With FireFox: it can't find my pages because the addresses have a "%5C" instead of "/" embedded. When I change it manually it works.

                    Navigator 9: I get a page not found yet the page is there. IE can find it on my other PC.

                      ok...can one of you lazy trds help me out now? thnx :-)

                        bradgrafelmann, I have sent you the link, username and password in a private message. Hope you received it. I am sure everybody understands that I don't want the entire world to know.

                          interesting, interesting.....

                          I clicked on your name/send private message, typed it in and submitted it. My e-mail address is [email removed]

                            Resolved: As the last resort, I formatted my harddrive, re-installed Windows XP Pro and it works. At this point, only the Good Lord knows what was wrong. However, I can say that it had nothing to do with my code. Somehow, somewhere something had been corrupted through whatever.

                              Write a Reply...