Domain & Subdomain session in PHP

Domain & Subdomain session in PHP

How can you  query session variables of domain and subdomain? It’s very simple and easy.

You can:

- Config session of web host server (e.g: Apache, IIS,…)

or

- Implement PHP code to solve session problem:

Code:

1
2
3
4
5
6
7
8
9
10
11
function k_session_start ($time = 3600, $ses = ‘MYSES’, $site =.jenshan.info”)
{
session_set_cookie_params($time,/, $site);
session_name($ses);
session_start();

// Reset the expiration time upon page load
if (isset($_COOKIE[$ses]))
setcookie($ses, $_COOKIE[$ses], time() + $time,/, $site);

}

35 Comments

Leave a Reply