Hello Carlos,

Something like this (assuming that the field with the type of the user
- admin, sales, etc. - is called `Status`, and the table is called
$f=mysql_fetch_assoc(mysql_query("SELECT `Status`, COUNT(*) AS
`UserExists` FROM `Users` WHERE
`Name`='".$_POST['name']."' AND
if ($f['UserExists']>0) { // name and password are correct
switch ($f['Status']) {
                     case 'ADMIN': include "adminmenu.php"; break;
                     case 'SALES': include "salesmenu.php"; break;
                     // ...
                     } else {
                     die ("You entered either an incorrect login or an
                     incorrect password.");
                     I assume you store crypted passwords in your
                     database, and the algorythm is md5 (there are
                     better solutions, but I used it simply for this

With best regards from Ukraine,
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

----- Original message -----
From: Carlos Sura <carlos_s...@hotmail.com>
To: php-general@lists.php.net <php-general@lists.php.net>
Date: Tuesday, June 29, 2010, 10:46:14 PM
Subject: [PHP] Login form + User level access

Hello everyone.

I have this question: I'm developing a login system but what I need is to do is 
access levels

I mean, in my database I have this users:


So, What I do basically need is, when a user from sales log in.. I want him to 
see just the menu from SALES, He cannot see others menu options, and he can't 
get access, I was reading that I can do that with  Switch,  but really I have 
no idea about it... Any help?

Thank you.

Carlos Sura.

Do you have a story that started on Hotmail? Tell us now

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to