Php – Drupal Session User id for independent script


I am creating a simple script say a.php. I know that drupal 6 creates a session etc. So in my a.php I am trying to print_r($_SESSION); but that doesnt seem to work. What is the best way to get the logged in users userid in my program?

Sorry I am new to drupal. Thank you for your time.

Best Solution

Drupal's cron.php is a perfect example of a "simple" php script that uses the libraries in Drupal's /includes directory. The key lines in that file are:

include_once './includes/';

if you include those in your own code, your a.php file will have access to all of Drupal's context and libraries.

Related Question