Session information sharing on different subdomains

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.

I meant that the member’s ID is not saved with the form data in the database. Although the member’s session is active, it does not see the member’s ID when POSTing to the other subdomain.
While the a.example.com member logs in and can use the b.example.com site without any problems since he logs in; Unfortunately, the information of the member is not recorded in the form submission among the subdomains, but when the member logs in, the session are active in all subdomains.

ini_set('session.cookie_domain',
substr($_SERVER['SERVER_NAME'], strpos($_SERVER['SERVER_NAME'], "."), 100));
setcookie("MID", $_SESSION['uID'], 60 * 60 * 24 * 100, '/', '.example.com');
session_set_cookie_params(60 * 60 * 24 * 100, '/', '.example.com', false, false);
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);
session_start();

Thank you.

Hi, Emsanator

I would try to add SameSite=None to the session cookie:

Hi veocode,

Thank you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.