SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    May 2000
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im wondering how i create a cookie?

    i was reading an article on javascript and it said i should store a variable in a cookie. Though ive known about cookies for some time now, i have never looked into how they are created and how exactly they work.

    also. would anyone be so kind as to tell me what security issues go along with cookies? for example... passwords stored in cookies.

  2. #2
    exit();
    Join Date
    Jul 2000
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The cookies isn't much of a security issue..

    And anyway, what language do you want to code the cookie in? If in PHP, go to http://www.php.net

  3. #3
    Gong!
    Join Date
    May 2000
    Location
    Helsinki, Finland
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Although I'm not an expert with cookies, I think you should not store a password into a cookie, since they are usually transferred as a plain text and it could cause serious problems later.

    You can find few cookie-related resources here:
    http://cgi.resourceindex.com/Documen.../HTTP_Cookies/

    I found this column from CNet by Christopher Barr:
    http://coverage.cnet.com/Content/Voices/Barr/042996/

    "Cookie Security" - article on TheDevWeb:
    http://thedevweb.com/articles.asp?ID=4

    And finally, The Cookie Central:
    http://www.cookiecentral.com


  4. #4
    Hi there! Owen's Avatar
    Join Date
    Jan 2000
    Location
    CA
    Posts
    1,165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take some flour, sugar, chocolate chips (and if you want some nuts), add eggs, beat, and bake at 350 for 30 minutes.

    ...oh. that kind of cookies.

    Owen

  5. #5
    SitePoint Addict
    Join Date
    May 2000
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well im not sure what language i would want the cookie to be in. What I am looking into is the ability to have several different people be able to hit a login button on my site which then finds their cookie and inside the cookie is the URL of their personal page.




    so it wouldnt really hold a password, but actually just an URL that noone would guess.

    has this been done?
    if so i would love to use their script

  6. #6
    exit();
    Join Date
    Jul 2000
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could actually find a home page script and modify it to where you need it That may work..

    Also, it's not a security threat to have a password on a cookie (just don't put a credit card number on it! ) Thousands of sites (and large ones) store users' passwords on a cookie.

  7. #7
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I cover the use of cookies in JavaScript in my 3-part tutorial series, "Persistent Data without CGI" at Sausage Island: http://www.sausagetools.com/island/tutorials/
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  8. #8
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Owen
    Take some flour, sugar, chocolate chips (and if you want some nuts), add eggs, beat, and bake at 350 for 30 minutes.

    ...oh. that kind of cookies.

    Owen
    LOL! send me some Owen!

    With cookie, you should store some kind of identifications and then on the server side, you have a dictionary to look it up. Much safer.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  9. #9
    SitePoint Member
    Join Date
    Dec 2000
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It does depend on what language you want to do this in. Server-side (Perl, PHP, etc.), it has to do with sending special headers to the client. Client-side, there are various methods (i.e. document.cookie in Javascript). Pick up a book or read something online for more information.
    Brad Ediger
    Chief Programmer
    DynamixPro - Revolutionize Your Future
    http://www.dynamixpro.com/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •