SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    NJ/NY
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cookie across subdomains problem

    Hey all,
    I'm having a problem accessing and deleting cookies across all the subdomains. When a user logs into the main site (or on a subdomain), they are logged out again oftentimes when they visit a subdomain. Furthermore, if they log out from the main site, they are still logged into the subdomains.

    Here is what I've tried so far (fixes I googled), but they don't seem to do the trick.

    PHP Code:
        ini_set("session.cookie_domain",".nutang.com"); 
    I added that before session_start().

    I also added the 4th and 5th parameters to all my setCookie() calls, like so:
    PHP Code:
    setCookie("hash"$hashtime()+24*3600*15"/"".nutang.com"); 
    Anyone else encounered this problem before?

    Thanks!

  2. #2
    PHP Brainiac dg_den_golotyuk's Avatar
    Join Date
    Jul 2006
    Location
    Kiev, Ukraine
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe your ini_set() is disabled. Try to setting up the value right in php.ii or in .htaccess of you web-root
    DG [Den Golotyuk], Lead Developer
    Chestnut Software
    Avoid web outsourcing scams!
    Click here
    for a free downloadable report

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you sure your code changes have been applied to all pages?

    are some of your pages secure, eg https?

  4. #4
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    NJ/NY
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't have access to my root. How do I do it in .htaccess? Do Ij ust need to set it in the .htaccess file of public_html? (I'm using virtualhost, so the subdomains are all created with that .htaccess file.)

  5. #5
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    NJ/NY
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher
    are you sure your code changes have been applied to all pages?

    are some of your pages secure, eg https?
    Sorry, didn't see this post earlier. Yea, all the pages include the same header.php file. No, nothing is secure.

  6. #6
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    NJ/NY
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think .... the logged out problem is only an issue when the subdomain contains underscores. I haven't had a chance to test this hypothesis to any detail yet. However... could the underscores be a problem?

    (I'm still having the problem of not logging out of subdomains.)

  7. #7
    is_empty(2); foofoonet's Avatar
    Join Date
    Mar 2006
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nutang.com
    not
    .nutang.com

    try it.
    Upgrading to Mysql 5? Auto-increment fields now strict
    use NULL
    Or zero or leave the field name out completely.


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
  •