Can't access global user object after drupal_bootstrap I have a stand-alone php script with the following lines at the beginning:

define('DRUPAL_ROOT', '../../../../../');

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);                


And this is giving me access to all of Drupal's functions just fine, however, when I try to access the global user object, it's as if the user is not logged in (IE the user object says the user is anonymous and has a UID of 0), even though I know they are because when I browse the site normally, the user is logged in.

Why does it not pick up the user's session in my script?
The solution was a one line fix:

define('DRUPAL_ROOT', '../../../../../');
$base_url = 'http://' . $_SERVER['HTTP_HOST'];
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); 


Note the addition of $base_url