Session information sharing on different subdomains

Discussion in 'Programming/Scripts' started by Emsanator, Jan 16, 2022.

  1. Emsanator

    Emsanator Member

    I am sharing sessions between two subdomains and I can see the member's information in their different subdomains. If the member logs out, all subdomains are logged out. All is good so far.

    However, for example, the form information is POSTed to This form information is saved in the database, but the member's ID is not registered. No information is registered to the database with the member. What could be the reason for this?

    Thank you
    substr($_SERVER['SERVER_NAME'], strpos($_SERVER['SERVER_NAME'], "."), 100));
    setcookie("MID"$_SESSION['uID'], 60 60 24 100'/''');
    session_set_cookie_params(60 60 24 100'/'''falsefalse);
    ini_set('session.save_path'$pathStorageMembers 'sessions');
    ini_set('session.cookie_lifetime'60 60 24 100);
    ini_set('session.gc_maxlifetime'60 60 24 100);
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    That will definitely depends on how the original software is scripted, coded and programmed.

    I have quite similar problem, if not the same, when trying to code multiple tenancy e.g. in simplemachines, elkarte and flarum forum softwares.

    I guess the best way to resolve is to get back to the software developers and/or community for help, at least explain to you how session is coded and how it can be best / possibly modified.
  3. Emsanator

    Emsanator Member

    I am trying to develop the application of the site myself and thus I learn. Thanks for your help, I will continue to investigate this issue.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Is this an ispconfig server? if yes, do you use different websites in ispconfig? In ISPConfig, each website runs under its own Linux user and has its own session storage directory, so website A will not be able to read sessions from website b. If you want to have shared session storage for multiple websites, then I would use a database-backed session storage handler in PHP.
  5. Emsanator

    Emsanator Member

    Yes, but I thought it would work fine since it's under the same domain, I was wrong. I will research for the save session in the database, thank you for your suggestion.
    Last edited: Jan 17, 2022

Share This Page