24, July 2008

Different Users - Different parts of each page! - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  3rd party modifications (Moderator: Olaf)
Topic: Different Users - Different parts of each page!
« previous next »
Pages: [1] Print

Author Topic: Different Users - Different parts of each page!  (Read 884 times)
Cyberpunk Wannabe
*
Gender: Male
Posts: 43
280 credits
Members referred : 0


Lolo means Grandpa in the Philippines!


« on: Jan 06, 2007, 08:04:38 AM »

We allow different users to see different parts of each page, and to see completely different pages using this...

Adding $_SESSION['access_level'] to the class

As I suggested in...

http://www.webdigity.com/index.php/topic,2288.0.access_user+%3A%3A+Future+functions+and+updates.html Visit through proxy

(Reply 6 and Reply 8...)

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, 03:53:56 AM by Lan »
Cyberpunk Wannabe
*
Gender: Male
Posts: 43
280 credits
Members referred : 0


Lolo means Grandpa in the Philippines!


« Reply #1 on: Feb 07, 2007, 03:56:10 AM »

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=5503
Tags : access_level using access level... Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  3rd party modifications (Moderator: Olaf)
Topic: Different Users - Different parts of each page!
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 24, 2008, 11:44:53 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 35.712
Total Topics: 7.376
Total Members: 3.706
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: FortuneBeach

30 Guests, 4 Users online :

11 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.