Help with sessions on Log in and Log out

I am having some problem working with my script on session
stuffs. Well, i have a login page which authenticates users by
using sql script then if login is successful i have
PHP Code:

$_SESSSION['logged in']=true; and $_SESSION[userid]=$userid

and when login is true i have included the page based on the
access level of users . Like if it is a regular user i have
include "user.php" ; exit() and if admin i have included admin page.

Also i have a log out script which unsets the sessions variable
and distroy the session at last.
Also when admin loggs in to admin page i have a small php script
that checks for those session variables and if the are set and
"is true" then the pages are displayed.

My problem is when admin just comes out to the login page again
without log out it allows to login to the main page but in main
page if any < a href> link is clicked it goes back to login page.
So then i will have to go back and log out first and then log
in.. I am not sure why this strange things happens.
Also is there any way i can have a feature like when the users
click back button it wont allow to go back to that page unless he
is using the back button provided by the web interface.

I am new at the session stuffs, so i am not sure what i am doing
is really a safe way to code a php page. are there any other
things that i need to be aware of while using sessions.

Any suggestions or thoughts would be highly appreciated.