dtsnx44260 2015-01-06 10:36
浏览 27
已采纳

针对不同用户的Php登录系统[关闭]

I am new to Php programming and I'm having some troubles understanding it. I need to make a project that will manage students and their grades. I need to have 2 types of users, professors and students. A professor can add grades to students, and a student can only view his grades.

I managed to make a simple login system, using wampserver and phpmyadmin. Now I don't know how to represent the students and the professors (since the teachers can add grades I assume they are treated like some sort of admins and students are users).Should I put a checkbox on the login page? And after that I should create different pages to each type of user?

Do not get confused by my questions. I don't need any code just some ideas on how to get started. After that if I have any problems I will share my code also.

  • 写回答

4条回答 默认 最新

  • duanbi7204 2015-01-06 10:45
    关注

    This is all quite basic.

    Assuming you have saved the users in your database, you simply have to add a column to the table those users are saved in. You could call this column 'flags'. If the user is a student, you could give it the value 1. If the user is a professor however you would give it a value 2.

    In your code when you verify the login, i reckon you put their data in a SESSION. So now, with the new column present. Place that value in your SESSION as well.

    Now that we can distinguish user and professor, we could simply do:

    if ($_SESSION['flags'] == 2) {
        // Something only the professor can do
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 基于决策树的数字信号处理,2ask 2psk 2fsk的代码,检查下报错的原因
  • ¥20 python作业求过程
  • ¥15 wincc已组态的变量过多
  • ¥60 如图:直线与椭圆X轴平行,求直线与椭圆任意一点的相切坐标计算公式
  • ¥50 如何用python使用opencv里的cv::cudacodec::VideoWriter函数对视频进行GPU硬编码
  • ¥100 c#solidworks 二次开发 工程图自动标边线法兰 等折弯尺寸怎么标
  • ¥15 halcon DrawRegion 提示错误
  • ¥15 FastAPI Uvicorn启动显示404
  • ¥15 centos7.9脚本,怎么排除特定的访问记录
  • ¥15 关于#Django#的问题:我的静态文件呢?