I'm writing some php code to redisplay a node extracting some parameters from session variables.

However, I see that Drupal actually emulates or whatever, s session, saving the variables in the database for a user, so that when I close and then open the browser again, the last values of the last session' variables are still accessed???!!!

So how do I kill the session when the browser is closed, or re-opened again, I was looking at something called sess_destrou_uid() but now I can't work out how to access the current uid.

Lost with the way Drupal handles php session variables, and the documentation seens to be non-existent for includes/session.inc

Get dizzy looking at all the forum stuff trying to work out this sort of simple thing myself, so hoping someone in the know can simply point me to it.

Comments

SteffenR’s picture

You can get the current user_id by fetching the global $user object in your own module ..

global $user;
echo $user->uid;

SteffenR

ken.wakefield’s picture

Having executed my php code, I want to destrou all session variables, any idea how to do that please

SteffenR’s picture

user_logout should help you with your issue..

Just have a look at the API page:
http://api.drupal.org/api/function/user_logout/6

SteffenR