SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast Deo's Avatar
    Join Date
    Oct 2003
    Location
    Washington, USA
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Cookie Domain Issue

    Hi,

    Well i have kinda a small issue that I cant quite figure out. Heres my problem:

    I need to access information via a couple cookies on website X, while the cookies are being set on website Y using a setcookie function.

    When I attempt to create a cookie on website 'ydomain.com' by doing:
    PHP Code:

    setcookie
    ("id"'1234'time()+(60*60*24*365), "/"'.xdomain.com'0); 
    the cookie doesnt get set. Is there a way I can set and allow other domain's to read the cookies?

    Thanks!

  2. #2
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cookies, as far as I know, can only be created and accessed by the domain itself, not any other domain. If I were able to access cookies from other websites, it would create a huge security hole as I would be able to retrieve any password information stored in the cookies.

  3. #3
    SitePoint Enthusiast Deo's Avatar
    Join Date
    Oct 2003
    Location
    Washington, USA
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, php.net documentation talks breifly about allowing sites access to cookies, but I havent been able to find out how to allow access to another domain as of yet.

    Thought someone might know.

  4. #4
    SitePoint Enthusiast Deo's Avatar
    Join Date
    Oct 2003
    Location
    Washington, USA
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone else have any experience?
    Mark
    www.MySpaceWatcher.com
    Tracking & Statistics For MySpace.com Users

  5. #5
    SitePoint Guru dbevfat's Avatar
    Join Date
    Dec 2004
    Location
    ljubljana, slovenia
    Posts
    684
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As pointed out, you can't access cookies from different domains. The most you can do is read/write the same cookie in the same domain, no matter what subdomain and path are: *.domain.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
  •