[PHP] test for cookies, without reloading
Hello, Is there a way to test for cookies enabled/disabled, without reload the page and test for the preset cookie? echo setcookies(test); seems to be 1 always. Tnx, Bas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test for Cookies
Hi, I need to test for cookies. What is the simplest way to do this? Thanks - Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Test for Cookies
By trying to set a cookie and read it back. -Original Message- From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 24, 2001 11:50 AM To: PHP Mailing List Subject: [PHP] Test for Cookies Hi, I need to test for cookies. What is the simplest way to do this? Thanks - Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Test for Cookies
Karl J. Stubsjoen [[EMAIL PROTECTED]] wrote: Hi, I need to test for cookies. What is the simplest way to do this? Be a little more specific - do you want to know if there are cookies at all, or if there are specific cookies? Depends on the settings in the Data Handling section of your php.ini. With register_globals = On and track_vars = On, I can do this: both of these are On. Is this a *FOR SURE* way to tell if cookies are enabled on the client machine??? if (sizeof($HTTP_COOKIE_VARS) == 0) { error_log("no cookies!!!"); } or if (empty($HTTP_COOKIE_VARS["my_cookie_1"])) { error_log("my_cookie_1 doesn't exist!"); } HTH. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com Thanks - Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Test for Cookies
You'll need to at least reload the page so the cookie can be sent back to the server after it's set. Try this: it's taken directly from the annotations on the setcookie function page of the php manual. ?php $status = 0; if (isset($myTstCky) ($myTstCky == "ChocChip")) $status = 1; if (!isset($CCHK)) { setcookie("myTstCky", "ChocChip"); header("Location: $PHP_SELF?CCHK=1"); exit; } ? html headtitleCookie Check/title/head body bgcolor="#FF" text="#00" Cookie Check Status: ?php printf ('font color="#%s"%s/font ;', $status ? "00FF00" : "FF", $status ? "PASSED!" : "FAILED!"); ? /body /html -Original Message- From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 24, 2001 1:42 PM To: [EMAIL PROTECTED]; PHP Mailing List Subject: Re: [PHP] Test for Cookies By trying to set a cookie and read it back. Okayhere is the scenario: User originates from STATIC Html page, Links to my PHP Cookie Test Page I set a cookie in my PHP Cookie Test Page Can I then check (safely) for cookies right away in my PHP Cookie Test Page without involving a 3rd page? Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Test for Cookies
In IE | Tools | Internet Options | Security | Custom Level You'll find 2 items under Cookies - Allow cookies that are stored on your computer - Allow per-session cookies (not stored) Both haveing the options (enabled / prompt / disabled) The cookie test script is succesful if and only if "per-session" is enabled. Okay, my question is: Does the 2nd Cookie Option "Per Session" imply that "that as long as the browser(s) have not been closed down, that as long as any instance of IE is running, that we have infact NOT terminated a "Session" and a cookie which has been set in this session is available? No matter where the user browses to, the number of browser windows he opens, closes, jumps back and forth between (just as long as at least 1 instance of IE is running the entire time), is this "cookie session" still intact?" And what about NS? Karl - Original Message - From: "Brian V Bonini" [EMAIL PROTECTED] To: "Karl J. Stubsjoen" [EMAIL PROTECTED]; "PHP Mailing List" [EMAIL PROTECTED] Sent: Wednesday, January 24, 2001 12:56 PM Subject: RE: [PHP] Test for Cookies You'll need to at least reload the page so the cookie can be sent back to the server after it's set. Try this: it's taken directly from the annotations on the setcookie function page of the php manual. ?php $status = 0; if (isset($myTstCky) ($myTstCky == "ChocChip")) $status = 1; if (!isset($CCHK)) setcookie("myTstCky", "ChocChip"); header("Location: $PHP_SELF?CCHK=1"); exit; } ? html headtitleCookie Check/title/head body bgcolor="#FF" text="#00" Cookie Check Status: ?php printf ('font color="#%s"%s/font ;', $status ? "00FF00" : "FF", $status ? "PASSED!" : "FAILED!"); ? /body /html -Original Message- From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 24, 2001 1:42 PM To: [EMAIL PROTECTED]; PHP Mailing List Subject: Re: [PHP] Test for Cookies By trying to set a cookie and read it back. Okayhere is the scenario: User originates from STATIC Html page, Links to my PHP Cookie Test Page I set a cookie in my PHP Cookie Test Page Can I then check (safely) for cookies right away in my PHP Cookie Test Page without involving a 3rd page? Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Test for Cookies (Stored vs. Session)
So my Point is: What if you require "stored cookies" - cookies written to the users disk? Hmmm, this cookie test would return true if "per-session" cookies was enabled and "stored cookies" was disabled. Karl - Original Message - From: "Karl J. Stubsjoen" [EMAIL PROTECTED] To: [EMAIL PROTECTED]; "PHP Mailing List" [EMAIL PROTECTED] Sent: Wednesday, January 24, 2001 1:49 PM Subject: Re: [PHP] Test for Cookies In IE | Tools | Internet Options | Security | Custom Level You'll find 2 items under Cookies - Allow cookies that are stored on your computer - Allow per-session cookies (not stored) Both haveing the options (enabled / prompt / disabled) The cookie test script is succesful if and only if "per-session" is enabled. Okay, my question is: Does the 2nd Cookie Option "Per Session" imply that "that as long as the browser(s) have not been closed down, that as long as any instance of IE is running, that we have infact NOT terminated a "Session" and a cookie which has been set in this session is available? No matter where the user browses to, the number of browser windows he opens, closes, jumps back and forth between (just as long as at least 1 instance of IE is running the entire time), is this "cookie session" still intact?" And what about NS? Karl - Original Message - From: "Brian V Bonini" [EMAIL PROTECTED] To: "Karl J. Stubsjoen" [EMAIL PROTECTED]; "PHP Mailing List" [EMAIL PROTECTED] Sent: Wednesday, January 24, 2001 12:56 PM Subject: RE: [PHP] Test for Cookies You'll need to at least reload the page so the cookie can be sent back to the server after it's set. Try this: it's taken directly from the annotations on the setcookie function page of the php manual. ?php $status = 0; if (isset($myTstCky) ($myTstCky == "ChocChip")) $status = 1; if (!isset($CCHK)) setcookie("myTstCky", "ChocChip"); header("Location: $PHP_SELF?CCHK=1"); exit; } ? html headtitleCookie Check/title/head body bgcolor="#FF" text="#00" Cookie Check Status: ?php printf ('font color="#%s"%s/font ;', $status ? "00FF00" : "FF", $status ? "PASSED!" : "FAILED!"); ? /body /html -Original Message- From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 24, 2001 1:42 PM To: [EMAIL PROTECTED]; PHP Mailing List Subject: Re: [PHP] Test for Cookies By trying to set a cookie and read it back. Okayhere is the scenario: User originates from STATIC Html page, Links to my PHP Cookie Test Page I set a cookie in my PHP Cookie Test Page Can I then check (safely) for cookies right away in my PHP Cookie Test Page without involving a 3rd page? Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]