Sunday, April 3, 2011

Drupal Session User id for independent script

Hello,

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.

From stackoverflow
  • 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/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    

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

0 comments:

Post a Comment