我有用户帐户注册页面..用户在其中输入诸如用户名,密码,电子邮件,姓名等信息.以及点击注册时.用户注册成功.我希望每当用户注册到网络时..他的注册将一直待处理,直到得到管理员的批准为止.在管理员启用受限于Web的用户后,他可以登录,然后可以登录,否则他不能....我该怎么做?
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??
推荐答案如果将用户信息保留在数据库中,则可以有一个类似UserStatus的列.在代码中,它应该类似于枚举集: 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: [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;
您的数据库可以在此列中存储一个数值,它是UserStatus枚举值的按位组合,您可以将其从数值类型强制转换为UserStatus并返回. 要进行批准和其他管理操作,您可以拥有一个特殊的管理网页,例如受密码保护,或设计一个特殊的数据库访问应用程序,该应用程序只能在本地网络中访问.
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.
更多推荐
在管理员批准后启用新用户注册.
发布评论