dongyi8795 2015-06-19 03:40
浏览 45

PHP MySQL管理员级别

This is my user table

CREATE TABLE `users` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `firstname` VARCHAR(255) NOT NULL,
  `lastname` VARCHAR(255) NOT NULL,
  `email` VARCHAR(255) NOT NULL,
  `username` VARCHAR(255) NOT NULL,
  `password` VARCHAR(100) NOT NULL,
  `level` ENUM('0','1') NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)

So lets say I am on index.php

I want that if user level = 1, then he can see a link appear on the page. Other wise if level = 0, he will never see that link.

How can I do that?

  • 写回答

4条回答 默认 最新

  • doudi1978 2015-06-19 03:44
    关注

    You should use session codes. Set a session code value to the value of level, and depending on that value display the link or not.

    评论

报告相同问题?

悬赏问题

  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python