Thread: Cookies

    #1
  1. No Profile Picture
    stefanbecker
    Guest
    Devshed Newbie (0 - 499 posts)
    Hi,

    i want to make a user friendly site. I am working on a little searchengine. I want to make the site so a user can set up their own look and functions, like how much output after a query or if he wants the news on the index page and so on. I heard its a good thing to use cookies for that. I already studied the cooky func but there are a few things i dont get.
    How many variables can I save to a cooky?
    How do I get the variables out of a cooky?
    There is a time field to set up but i want it to be available forever, how can i dot that?

    Thx for answer
  2. #2
  3. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    Basiclly PHP treats cookies as if they where a variable. You don't store any number of variables inside a cookie per se, but the cookie itself is the variable and it's value is equal to whatever text you stored in the cookie.

    For example if I stored a cookie name UserConfig with the value "bleh" on a user's machine, the next time that user access one of my sites the variable $UserConfig will equal "bleh"

    If you need to store more than one variable in a cookie take a look at the serialize/unserialize and the explode/implode functions. They will enable you to store multiple values in one cookie.

    Also you have to specify a time for the cookie to expire. You can not set a cookie to last forever. The best you can do is to set it for the maximum time you can.

Similar Threads

  1. cant delete cookies random errors
    By toxical in forum PHP Development
    Replies: 2
    Last Post: November 26th, 2003, 06:16 AM
  2. Clearing all cookies php script - HowTo?
    By fordfasterr in forum PHP Development
    Replies: 8
    Last Post: October 24th, 2003, 10:40 AM
  3. Problem with lwp and cookies
    By vinaykakade in forum Perl Programming
    Replies: 1
    Last Post: August 13th, 2003, 11:07 AM
  4. Problems setting cookies with a path and domain
    By IBBoard in forum PHP Development
    Replies: 4
    Last Post: July 2nd, 2003, 04:03 PM
  5. AOL cookies?
    By cfthong in forum PHP Development
    Replies: 0
    Last Post: August 18th, 2000, 11:59 AM

IMN logo majestic logo threadwatch logo seochat tools logo