[b]code1[/b]
<?php session_start(); ?>
With the browsers of chrome, safari, fireFox and opera, Sessions in myDomain.com doesn’t work in subDomain.myDomain.com with the code1 above.
In order to work the sessions in subDomain.myDomain.com as well as in myDomain.com, I change the code above to the code2 below.
[b]code2[/b]
<?php
ini_set(session.cookie_domain', 'myDomain.com');
session_start();
?>
The code2 above works fine.
The sessions in myDomain.com are shared in subDomain.myDomain.com.
Now I have another problem.
I like to make it like the following.
The sessions in myDomain.com are not only shared in subDomain.myDomain.com, but also shared in myDomain2.com and subDomain.myDomain2.com.
The trial code code3 below doesn’t work as I expected.
The sessions doesn’t work in myDomain.com but they works in myDomain2.com only.
The trial code code4 below neither work as I expected.
The sessions doesn’t work in myDomain2.com but they works in myDomain.com only.
[b]trial code3[/b]
<?php
ini_set(session.cookie_domain', 'myDomain.com');
ini_set(session.cookie_domain', 'myDomain2.com');
session_start();
?>
[b]trial code4[/b]
<?php
ini_set(session.cookie_domain', 'myDomain.com[B][COLOR="#FF0000"];[/COLOR][/B] myDomain[B]2[/B].com');
session_start();
The would-be code5 below doesn’t work correctly, but I hope it shows what I want.
[b]would be code5[/b]
<?php
ini_set(session.cookie_domain', 'myDomain.com[B][COLOR="#FF0000"],[/COLOR][/B] myDomain[B]2[/B].com');
session_start();
?>
How can I make the sessions do work across 2 domains?