RE: Re[2]: [PHP] Login form + User level access
| From: | Carlos Sura | Date: | Tue, 29 Jun 2010 20:13:08 +0000 |
| Subject: | RE: Re[2]: [PHP] Login form + User level access | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-306541@lists.php.net to get a copy of this message | ||
Hello Andre,
Thank you so much, Now I really get the idea.
Oh, can I replace that adding inthe table of access_level a field called: 'level_numbers'
?? would it be the same thing??
Carlos Sura.
> Date: Tue, 29 Jun 2010 23:08:51 +0300
> From: andre@oire.org
> To: andre@oire.org
> CC: carlos_sura@hotmail.com; php-general@lists.php.net
> Subject: Re[2]: [PHP] Login form + User level access
>
> Hello Carlos,
>
> What I forgot to add is the following:
> I'd suggest you to put in the integers and not the strings
> (1 instead of PURCHASER, 2 instead of SALES etc.). It will
> quicken the process.
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
>
> ----- Original message -----
> From: Andre Polykanine <andre@oire.org>
> To: Carlos Sura <carlos_sura@hotmail.com>
> Date: Tuesday, June 29, 2010, 11:04:53 PM
> Subject: [PHP] Login form + User level access
>
> 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
> Users):
> $f=mysql_fetch_assoc(mysql_query("SELECT Status, COUNT(*)
> AS
> UserExists FROM Users WHERE
> Name='".$_POST['name']."' AND
>
> Password='".md5($_POST['pass'])."'"));
> 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
> example).
>
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
>
> ----- Original message -----
> From: Carlos Sura <carlos_sura@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:
>
> Admin
> Superusers
> sales
> purchase
> etc
>
> 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.
>
>
>
>
>
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/197222280/direct/01/
> 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
Do you have a story that started on Hotmail? Tell us now