A really good source related to your question from drupal.org's forum:
Struggling with Session Variables (the
$_SESSION array) when redirecting to external php scripts
The key for codes outside Drupal's full control to work is to save PHP's current working directory, change it to Drupal's, requiring the needed file to bootstrap Drupal (
includes/bootstrap.inc), pass the appropriate
$cookie_domain variable ("the domain to be used for session cookies"!), bootstrapping Drupal, and then change the current working directory back to the original. After this, you can write your own codes and use Drupal's functions, mess with its session variables, etc. - of course, depending on the bootstrapping mode of Drupal.
The code to achieve it looks like this (you have to change
$your_drupal_directory variable to yours, usually this is in the root, but its path can be different [e.g. if it's in a subdirectory]):
* @see http://drupal.org/node/575002
// store current working directory
// which is your Drupal directory? (usually it's in the root, but can be different)
$your_drupal_directory = $_SERVER['DOCUMENT_ROOT'];
// change PHP's current directory to Drupal's
// including bootstrap file...
// The domain to be used for session cookies. (see: http://api.drupal.org/api/drupal/developer!globals.php/global/cookie_domain/7)
$cookie_domain = $_SERVER['HTTP_HOST'];
// DRUPAL_BOOTSTRAP_SESSION: initialize session handling.
// the code above should be enough for your task, but if you want Drupal to be "fully loaded, validate and fix input data", you could try the following too (see: http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/drupal_bootstrap/7)
// drupal_bootstrap( DRUPAL_BOOTSTRAP_FULL );
// change PHP's current directory BACK to the original
// YOUR OWN CODE COMES HERE