#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    15
    This one works, it deposits a cookie in the appropriate directory:

    setcookie ("TestCookie",$cook_value,time()+604800);

    This one does not - no cookie is set whatsoever:

    setcookie ("TestCookie",$cook_value,time()+604800,"/",0);

    Neither does this one - no cookie is set with this either:

    setcookie ("TestCookie",$cook_value,time()+604800,"/","www.domain.com",0);

    What is the rule with the domain arguement - is it absolutely necessary, and when is it ever beneficiary?

    - Mike
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Posts
    7
    Rep Power
    0
    What's the use of a cookie if you don't save the site it was set on to it? I think that's what they are used for, track user's activity on your site and in order to do that.

    I'd just add the domain, so my scripts don't screw up and mistakenly read a cookie, that doesn't belong to my site and misinterpret the given information.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Melbourne, Australia
    Posts
    5
    Rep Power
    0
    The domain is not required. If it is not added, then it defaults to the domain that the cookie was sent from.

    [This message has been edited by seamusharris (edited November 20, 2000).]
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    7
    Rep Power
    0
    totally correct...

    the domain that throws the cookie is the only one that can read it....

    if you add a doamin to the end (concat) you can force and new domain to read it ie. http://www.domain.com to =>
    https://blahblah.secure-hosting-thingy.net

    hope this helps.

    btw :: i never use the domian argument
    ccbcreg


    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by seamusharris:
    The domain is not required. If it is not added, then it defaults to the domain that the cookie was sent from.

    [This message has been edited by seamusharris (edited November 20, 2000).]
    [/quote]



    [This message has been edited by ccbcreg (edited November 20, 2000).]
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    The second one skips the domain argument, which might cause browsers take the security argument as that of domain.

    You don't need to add 'www' to the domain name, just use .domain.com. If you specify www.domain.com, I don't think cookie name and value is to be retrieved when a browser windows accesses http://domain.com

    Just give it a try and let me know if I'm correct.

    This page will help you get you started understanding cookie with PHP. I learned from Julie's article in Webmonkey. http://hotwired.lycos.com/webmonkey/...tw=programming

IMN logo majestic logo threadwatch logo seochat tools logo