If you don't want to set any local cookie, you'll need to stick to sessions. Having a session across sub domains works a tiny bit different than just on one domain. So lets get started.
First we'll need to give our session cookie a new session_name(). We need to do this because a session name must be defined before setting cookie parameters. This will store the old session name under $old_name
and update the name of your session to "some_name":
$old_name = session_name("some_name");
Next we'll have to set the session cookie parameters with session_set_cookie_params(). Here's where we tell our server where the session cookie will function:
session_set_cookie_params(0, '/', '.tld.com');
By preceding the 3rd paramenter (domain "tld.com") with a dot, we're making sure the session cookie will be visible on all subdomains. As an alternative, you could also use:
ini_set('session.cookie_domain', '.tld.com');
Lastly ofcourse we need to start or resume our session in our script with session_start():
session_start();
So to sum it up, you should have this on top of each script that'll use your sessions:
<?php
$old_name = session_name("some_name");
session_set_cookie_params(0, '/', '.tld.com');
//ini_set('session.cookie_domain', '.tld.com'); //Uncomment and comment above line if prefered.
session_start();
As a sidenote I should include that setting php.ini parameters isn't allowed on most shared hosting providers. This script assumes you've got full access to your server or at least a provider willing to let you change those settings.