It’s easy to think that you can’t use $_SESSION in Drupal as it’s configured in a different way to a normal PHP site…
I haven’t looked into it in-depth, but the ‘user’ table in the database shows how visitors to the site are seen. The first in the table is empty with an I’d of zero… This represents ‘anonymous’ users… The visitors SessionID is also stored in the database…
So you can see why if you add a custom page to your site, the standard PHP Session call doesn’t work…
… And that’s where some people stop…
The truth is, as long as you set and call your Session in your page.tpl.php page, Sessions will work as you’d expect…
Also see How to ‘Piggyback’ Drupal.
Main Category