PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old July 13th, 2002, 03:55 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Permission Question

Hello fellas. I created my first login and password authorization pages the other day. However, I was wondering what the concept is behind permissions. In other words, say I am an administrator. When I login I should be able to see things that a 'normal' user cannot see. can someone explain this concept to me?

Thanks in advance

-- Jason

Reply With Quote
  #2  
Old July 13th, 2002, 04:29 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Permission Question

i have this on my site aswell. In the members table, i have a permission column, and the default is 1, admin is 2. When the user logs in, the page checks to see what permission level the user has, if its 1, just displays the normal links, if it is 2, then it displays my admin features, such as being able to delete news threads, and members etc...very useful on my site

Reply With Quote
  #3  
Old July 13th, 2002, 04:50 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Permission Question

can you show me a snippet of the code? I am trying to understand how you actually do the checking.

TIA -- Jason

Reply With Quote
  #4  
Old July 13th, 2002, 05:09 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Permission Question

php Code:
Original - php Code
  1.  
  2. <?php
  3. mysql_connect(HOST, USER, PASS)
  4.     or die("Couldnt connect to database");
  5.     or die("Couldnr select database");
  6. $result = mysql_query("SELECT * FROM members WHERE USERNAME='{$_SESSION['username']}'");
  7. $row = mysql_fetch_array($result);
  8.  
  9. if($row['LEVEL'] == '2') //LEVEL is the column which contains the permission level
  10. {
  11.     include('adminLinks.php'); //admin links, are you guessed it, my admin features
  12.     exit;
  13. }
  14.                
  15.        
  16. ?>


okay, what i have done, is everyone, no matter what user level, sees the normal links in the members area, so i didnt need to do anything for that, all i do, is create my admin links (my special privledges) on a different page, (adminLinks.php) and if that user has a permission LEVEL of 2, then it includes the special features. Does that make sense?

Reply With Quote
  #5  
Old July 13th, 2002, 05:12 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Permission Question

LOL,....after I posted the 2nd time I got to thinking about it,....you posted exactly what I was thinking,...lol,.... but thanks for the code post.

-- Jason

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Permission Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway