tags:

views:

320

answers:

2

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: 
  1. Introduce an "approved" column into the user table which indicates whether or not the account is approved
  2. Provide an interface for administrators to view a list of such accounts and toggle their approval status
  3. Update existing authentication code to check this column and disallow the use of "unapproved" accounts
Rob
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
do u have any codes 4 that?if i read it i will be able to understand it
shah.shakthi
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
+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
Yes, that's pretty sound advice - a CHAR(1), or perhaps an ENUM containing valid account states.
Rob
@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