I think it is a good idea to add $_SESSION['access_level'] to the class to make easy use of the access_level for things like selecting menu items and page content based on access_level.
I was able to do this with just a couple small modifications to the class... here they are...
Note: I have tested these but you should proceed at your own risk...
First I modify the function log_out in keeping with the current way of doing things on the PHP Manual for session_destroy. As noted on the above mentioned post (Reply 4). This would also allow extention classes to add $_SESSION Vars as they pleased.
Quote
function log_out() { // unset($_SESSION['user']); // unset($_SESSION['pw']); // unset($_SESSION['logged_in']); $_SESSION = array(); session_destroy(); // new in version 1.92
Next I add the $_SESSION['access_level'] to the function set_user...
Quote
function set_user() { $_SESSION['user'] = $this->user; $_SESSION['pw'] = $this->user_pw; $_SESSION['access_level'] = $this->get_access_level(); $_SESSION['logged_in'] = time(); // to offer a time limited access (later)
That's it! Now you can use $_SESSION['access_level'] to test with so you can include or exclude whatever you want in your PHP webpages based on the access_level!
I am hoping this will be added to future versions of the access_user_class! It is highly valuable to me!
Thanks Olaf - this is a great class and getting even better!
-Lan Tait (With a name short enough to fit in a DOS file - how could I go wrong!)
« Last Edit: Feb 07, 2007, 02:53:56 am by Lan »
Cyberpunk Wannabe
Gender:
Posts: 43
280 credits Members referred : 0