Re: Login System with access levels

From: Date: Fri, 16 Mar 2001 15:00:57 +0000
Subject: Re: Login System with access levels
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-44307@lists.php.net to get a copy of this message
One solution: You set up a separate table: user_level { level_id (unsigned int), level_description (varchar 100 )} it looks like this: level_id level_description 100 admin 200 user In your user table you add level_id as a field. After a good validation of the user (username and password), you grab the level_id and make a session variable out of it. Than in you page you decide what you show or not to the user based upon the level_id if( $level_id <= 100 ){ show link for admin } if( $level_id >= 101 && $level_id <= 200 ){ show link for user } Having another table and separating the id by a hundred number lets you add more security level as the site grows. This is one solution, I am shure there is many more and I would like to see what other people do as well... py ----- Original Message ----- From: Jordan Elver <jord.elver@virginnet.co.uk> To: PHP General Mailing List <php-general@lists.php.net>; PHP DB Mailing List <php-db@lists.php.net> Sent: Friday, March 16, 2001 7:28 PM Subject: [PHP] Login System with access levels > Hi, > I've got a db with a username and password in it. I can let people log in, > like SELECT * FROM table WHERE username = username AND password = password. > > But how can I add an access level column so that I can have different levels > of security. So admin's can read everything, but users can only read certain > sections. > > How could I add to my db and structure a query? > > Any ideas would be good, > > Cheers, > > Jord > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#44307) next »