[thelist] session_name ('whatever')

Bob Meetin ontheroad at frii.com
Tue Mar 13 14:12:46 CDT 2007


On several sites I'm using sessions to start every page (all .php). 

session_name ('whatever');
session_start ();

I do this because in some of the pages I have edit functions.  If 
someone selects  'login.php' and successfully logs in, I set up a few 
variables such as user type (admin, user, etc.) and a few other privileges.

$_SESSION['stype'] = $row[type];  // this grabs user type out of the db 
and sets a session variable.

So for instance if you were to select the FAQ page and are logged in as 
an admin you get the 'edit' button and are authorized to use the 
update/edit page as well.  I'm also using the session to control my 
navigational menus.  If you are 'logged in' you get an extended or 
different version of the menu with administration options.

All this seems to work flawlessly.  The apparent problem - cosmetics.  
When you first access the home page, the information area at the bottom 
of the browser (Firefox) displays navigational links with the session 
variable.  Then if you select one of the links it will display the link 
with the session id as well.  None of this causes any problems but it 
sure looks dumb.

Is there a way to disable displaying the variables without breaking the 
functionality?  Or is that way sites commonly set up administration 
under an admin directory, making it less apparent?  Or of course have I 
done something else wrong?

The other odd thing - once I have selected one of the links (without 
being logged in) such as hitting 'Home' twice, the session variables 
will eventually cease display.  But again - nothing breaks. If you opt 
to login all is fine in Mayberry.

-Bob




More information about the thelist mailing list