i created a register page n login page 4 members in php n mysql.and also i created a admin account and now i want to do something like if the member register he will be added only when the administrator approves it.please help
+1
A:
- Introduce an "approved" column into the user table which indicates whether or not the account is approved
- Provide an interface for administrators to view a list of such accounts and toggle their approval status
- Update existing authentication code to check this column and disallow the use of "unapproved" accounts
Rob
2008-12-03 04:56:23
i am new to php so how can i provide interface for administrator to view a list of such accounts and toggle their approval status?
shah.shakthi
2008-12-03 04:59:43
do u have any codes 4 that?if i read it i will be able to understand it
shah.shakthi
2008-12-03 05:02:52
With regards to generating the list, I assume you can write a SELECT query and execute it? Toggling status is a simple UPDATE operation.
Rob
2008-12-03 05:07:55
+3
A:
The knee jerk reaction is to add a boolean column to the users table with a default value of false. However the best route is probably a CHAR(1) column with a default of 'P' for pending. Then when an admin makes a choice they can approve (set to 'Y') or deny (set to 'N') they won't have to look at everything (just list all users where the column is ='P')
Andrew G. Johnson
2008-12-03 05:02:52
Yes, that's pretty sound advice - a CHAR(1), or perhaps an ENUM containing valid account states.
Rob
2008-12-03 05:07:03
@Rob - Ya good call, I agree ENUM is smarter, most important point here though is the three states instead of the kneejerk two
Andrew G. Johnson
2010-07-10 08:40:00