how to validating a user.,

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
heero
Forum Newbie
Posts: 1
Joined: Mon Jul 21, 2008 10:27 pm

how to validating a user.,

Post by heero »

:|
how to apply a php code to fetch record in my database(MySqL:SQLyog) that determine whether a
the user is an "admin" or just "user"? My database "tblmember" has this following fields
"id, username, password, accessLvl "., accessLvl ("admin and user ").,

Hope for a positive response.,
User avatar
Verminox
Forum Contributor
Posts: 101
Joined: Sun May 07, 2006 5:19 am

Re: how to validating a user.,

Post by Verminox »

Code: Select all

SELECT * FROM `tblmember` WHERE `username` = 'something' AND `accessLvl` = 'admin'
If one row is the result, that means the user is indeed an admin.

Alternatively, if you have already fetched all the details of the user in a previous query, the information must be in the PHP variable where you stored the results. So for example, you can check $user['accessLvl'] and see if it is 'admin' or 'user'
Post Reply