dongrong9053 2015-01-02 16:29
浏览 34
已采纳

多级注册/登录系统

I want to create a multilevel register/login system with 2 types of users: admin and normal users. I have read some articles and tutorials, but I still have some questions. I know that I need to have a table with the following columns: username, password and type (0 - normal user, 1 - admin) and when a user tries to login, he will be redirected to a certain page based on the type.

Now, the process of registration for a normal user is quite straightforward, but my question is, how do you register an admin user?

Do you add a admin user directly in the database using sql? Do you create a special PHP page for this?

Like I said, I have read some tutorials but I didn't found an answer to this question.

Thanks in advance!

  • 写回答

3条回答 默认 最新

  • dsbfbz75185 2015-01-02 16:38
    关注

    It depends on the kind of application / website you are going to code.

    If you're planning on building an expanding, modular site, adding admins directly via SQL is not the right way. Then a separate page would be best, that only existing admins or operators (that would require more ranks, but in any bigger sytem, there are more than two ranks anyway) can access.

    However, if you just want to test things out, adding those special accounts via SQL requires much less effort than coding a separate page only for this purpose.

    Note that user / group privilege management is a critical security part, so make sure to check things on the server (--> input validating).

    Added content : Depending on the size of the project and the scalability you want to achieve, you may consider separate tables for the privileges of users / groups, which could be included to your SQL statements using JOINs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教