Drupal 7 sessions

https://api.drupal.org/api/drupal/includes!session.inc/7

yeah, do not forget to define the base url, something like:
$base_url = ‘http://’.$_SERVER[‘HTTP_HOST’];

I’d start php script like:

<?php

define('DRUPAL_ROOT', '../');
 $base_url = 'http://'.$_SERVER['HTTP_HOST'];

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
 drupal_add_http_header('Content-Type', 'text/html; charset=UTF-8');

drupal_session_initialize();
 drupal_session_regenerate();
 //print_r($_SESSION);
This entry was posted in Uncategorized. Bookmark the permalink.