★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/001397.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  PHP
  Trim number of cookies?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Trim number of cookies?
aarongb
Member
posted June 07, 2000 07:12 AM     Click Here to See the Profile for aarongb   Click Here to Email aarongb     Edit/Delete Message Reply w/Quote
Howdy all,

I am trying to figure out how to trim number of cookies.
My code presently sets 3-4 different cookies, based on the type of user, so they are set normally

setcookie ("cookie_name1", "$cookie_name1",time()3600);
setcookie ("cookie_name2", "$cookie_name1",time()3600);
setcookie ("cookie_name3", "$cookie_name1",time()3600);
(don't take this code to seriously, just an illustration)

How can I trim these into a single setcookie
setting all the variables in a single string?

Any ideas?

ujludwig
Member
posted June 07, 2000 12:45 PM     Click Here to See the Profile for ujludwig   Click Here to Email ujludwig     Edit/Delete Message Reply w/Quote
Just set the cookie with the values delimited (usually by comma) and then when the cookie is submitted, just explode the cookies value into an array....

setcookie ("mycookie","ulysses, joe, jim",time()+3600);

$L_mycookie_array = explode(",",$mycookie);

$myvar1 = $L_mycookie_array[0];
$myvar2 = $L_mycookie_array[1];
$myvar3 = $L_mycookie_array[2];

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.