#1
  1. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    17
    I am writing some forum software, and I would like to add the feature so that people can have the option for the forum to remember their username and password. Can I store both the username and password in one cookie, or do I have to do it with two cookies? I thought that I could separate the username and password with a pipe symbol then store them in a cookie, and then when I retrieve the cookie, I could spilt the data at the cookie forming an array or something like that, I'm not too familiar with this stuff.

    Any ideas?

    --------------------------------------------
    Alex
    (http://www.alex-greg.co.uk)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Ontario, Canada
    Posts
    498
    Rep Power
    18
    You can post as much data as you want in a cookie. For example's sake, when I had installed VBulletin (some php ripoff of UBB), it stored the username, password and last visit in a cookie. You can call the cookie variables with $HTTP_COOKIE_VARS[], where the array value is the name of the variable.

    ------------------
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    35
    Rep Power
    15
    Hi, alexgreg
    I encountered this question a few days ago, but what I want is to store two value in one cookie name, not in an cookie array.
    Here is my snip, hope to help:

    -------------------------set cookie-
    $name = $user_name;
    $password = md5($user_password);
    $cookie = $name . "+|+" . $password;
    setcookie("cookie",$cookie)
    -------------------------set cookie+

    -------------------------get cookie-
    list($name,$password) = split("+|+",$cookie);
    -------------------------get cookie+

Similar Threads

  1. Replies: 3
    Last Post: March 5th, 2004, 08:08 AM
  2. Placing user-entered data into cookie
    By Tyrone in forum Perl Programming
    Replies: 2
    Last Post: February 17th, 2004, 04:31 PM
  3. Take single values and storing them in memory
    By kingtoad in forum Java Help
    Replies: 2
    Last Post: January 27th, 2004, 11:07 PM
  4. Zip code validation
    By krwyth in forum MySQL Help
    Replies: 2
    Last Post: January 5th, 2004, 01:29 PM
  5. w3c strict errors (10), css, and js questions
    By WorldBuilder in forum CSS Help
    Replies: 12
    Last Post: November 6th, 2003, 04:48 AM

IMN logo majestic logo threadwatch logo seochat tools logo