dtsnx44260 2015-01-06 10:36
浏览 27


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
    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 关于用abap来解决动态规划的问题,但是要求输出索引值,这个是难点
  • ¥15 在ISIS中什么是IP从地址
  • ¥15 压测时,并发量过高时,响应时间出现尖刺
  • ¥15 关于vmprotect3.8.4虚拟文件一项
  • ¥15 在不用IT调试的情况下怎样能连外网
  • ¥20 C#调用虚拟键盘TabTip.exe
  • ¥15 Qt4代码实现下面的界面
  • ¥15 CCS离散化传递函数与仿真不一致
  • ¥15 prism提示我reinstall prism 如何解决
  • ¥15 asp.core 权限控制怎么做,需要控制到每个方法