Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have users account registration page.. where user put information such as username, password ,email, name, e.t.c. and when the click register. user registration is sucessful. i want that when ever user register to the web.. his registration wil remain pending until it is approved by the admin. after admin enable the user rigestered to web, he can login then he can login otherwise he can't.... how can i doo that??
Posted
Updated 3-Mar-12 16:55pm
v2
Comments
Sergey Alexandrovich Kryukov 3-Mar-12 15:53pm    
What's the problem? It looks straightforward. What did you try?
Do you store user information in database.
--SA
codegeekalpha 3-Mar-12 22:39pm    
i havn't get it? i did login coding using sessions... ???

1 solution

If you keep user information in database, you can have a column like UserStatus. In the code, it should be something like enumeration a bit set:
C#
[System.Flags] enum UserStatus {
    None = 0,
    ApprovalPending = 1, //approved if this bit it clear
    Logged = 2,
    //... powers of 2
    Initial = ApprovalPending, // used only internally 
}

//usage:
UserStatus userStatus = UserStatus.Initial;
//same as UserStatus.ApprovalPending; //initial status immediately the user account is created

//to check a set element:
bool approvalPending == (userStatus & UserStatus.ApprovalPending) > 0;

//to include:
userStatus |= UserStatus.ApprovalPending;

//to exclude (approve):
userStatus ^= UserStatus.ApprovalPending;


Your database can store one numeric value in this column, a bitwise combination of UserStatus enumeration values, you can cast it from numeric type to UserStatus and back.

For approvals and other administrative actions, you can have a special administration Web page, say, password protected, or devise a special database access application accessible only within the local network.

—SA
 
Share this answer
 
v2
Comments
codegeekalpha 3-Mar-12 22:39pm    
???????????????
Sergey Alexandrovich Kryukov 4-Mar-12 3:51am    
Very nice. What is it supposed to mean? Did not get a work or what?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900