se

Discussion in 'PHP' started by dizyn, Mar 28, 2009.

  1. #1
    Hi

    I have 1 domains with 3 sub domains I want to share login on all 3 sub domain and main domain I am using following code and It should work.

    
    session_set_cookie_params(3600, '/', '.mydomain.com');
    session_start();
    
    PHP:
    Any Idea?

    I want to know "has it something to do with server configuration?" or its because of something else?

    Thanks.
     
    dizyn, Mar 28, 2009 IP
  2. centralb

    centralb Peon

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To start:

    • Whenever you change how sessions and cookies are handled, be sure to first clear your browser's stored cookies before testing.
    • Try multiple browsers. Browser sometimes matters. If you're using IE7 or IE6 and the server name is resolved from .../etc/hosts, you might not even get a cookie set.
    • Be sure to call those two session functions for every page/request. The settings only apply during script execution, so each script will need to call those for proper cookie+session handling and access.
     
    centralb, Mar 28, 2009 IP
  3. Estevan

    Estevan Peon

    Messages:
    120
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    0
    #3
    hello

    this work for you

    session_start();
    setcookie("PHPSESSID", session_id(), 0, "/", ".yourdomain.com");

    Best
     
    Estevan, Mar 28, 2009 IP