Results 1 to 4 of 4

Thread: How do you make a cookie?

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Question How do you make a cookie?

    I want to make a simple (VERY simple) cookie that will be placed on my visitors browser when they visit one specific page (NOT the index)

    I have read and googled and read and googled and my eyes are about to pop out.

    I found a cookie writing program, and I wrote a cookie code that includes the information I want in the cookie.

    What I can NOT figure out, is how to impliment the cookie code into a specific page. Is the cookie its own page? Do I need to make a cookie file? do I need to add code to a .htm page? How does this get put into a cache on someone elses computer?

    EXAMPLE: Visitor browses site and ends up going to www.mysite.com/chocolatechip/peanutbutter.htm

    when they go to this page I want the cookie to be added to their cache then, and only then.

    Is this possible? I know it is, or else I wouldn'thave to clean out my cookies folder all the time... but how do I do it?

    Thanks!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Hee he hee. Thanks Twey, now, to be a horrible pain in the ass...

    Can cookies bet set up to run without using php? I am only 30 pages away on my site from going from page.htm to page.php...

    but in the meantime, I would like this cookie thing to be in the .htm pages.

    If it is not possible, I will put it off until I get to the php pages, but if it is possible that would be awesome.

    I just don't know how to set my site up to give cookies. I sort of understand how they work. I know what they do, how they are written (kind of) etc. Like I know you have to have them before the <HTML> with no white space, etc.. but I can't seem to get them to execute.

    Help?
    Thanks again
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You can just rename the .html pages to .php and use PHP.
    Apart from that... yes, you can read and write to document.cookie in Javascript just as any other variable.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •