Fetch user id on behalf of the non-drupal php I want simply to provide user id to php application that resides under my files/ folder. It is php that one flash app uses to create xml. This script, in my drupal root folder, works:

&lt;?php
define('DRUPAL_ROOT', getcwd());
require_once '/var/www/drupal/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
$user_uid= $user-&gt;uid;
echo $user_uid;
?&gt;


but when i try to include whole script in that php app in my files folder, it fails, with many include type errors.

I am searching for simple solution to provide that app with user id!

Thanks!
If you copy that code/file to another directory, DRUPAL_ROOT will be set to that directory, not that of drupal's... so I'd change up that first define to point to where drupal is and you should be all set.