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 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab