RE: [PHP-DB] Cookies ???

From: Date: Mon, 17 Sep 2001 17:29:44 +0000
Subject: RE: [PHP-DB] Cookies ???
Groups: php.db 
Request: Send a blank email to php-db+get-12508@lists.php.net to get a copy of this message
Q1. If you simply wish to READ the cookie from each web page, you need do nothing. It is created atuomatically as a variable for you. For instance, a cookie named "mycookie" is available as $mycookie. Q2. The Cookie Path is the reference point on the web server. I creates a context for the cookie. It allows the cookie to be read when a web page comes from that specific directory. If you want it to be available from all directories, use "/". Q3. The cookie can store multiple values that you concatenate together. For instance, to store username/password: setcookie( "cookiename", "$user#$password", time()+3600, "/", ".mydomain.com" ); Then, upon reading the cookie: list($user,$password) = explode( "#", $cookiename ); FYI...setcookie() has worked for me on IE 5.x and NN 5.x. -----Original Message----- From: Jason Caldwell [mailto:jason@thinkingman.org] Sent: Monday, September 17, 2001 11:35 AM To: php-db@lists.php.net Subject: [PHP-DB] Cookies ??? I've been reading the threads under SETCOOKIE (from php.net) -- some people are saying that setcookie doesn't seem to work for all browsers all of the time. Then some others go into how it seems to actually be the TIME format (unix time vs. GMT time) -- Should I just stick to the HEADER version instead of setcookie? Also -- I'm not completely clear on how cookies work in the first place... Q1: When I set a cookie, is that cookie automatically called from *each* page on my website? Or, do I need to add the HEADER to each page where I want to call the cookie? Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please explain what this is exactly, and how it works. Q3: The scenario I would like to use cookies in is to have users automatically be logged in when they come to my home page... so I will need to store the Username and Password in the cookie... should I store these in an Array, or can I create multiple cookies -- in other words, a cookie can only store one value, correct? So, I can use Serialize / Unserialize to store Array information in my cookies? Thanks. Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#12508) next »