当前位置:网站首页>Based on php online learning platform management system acquisition (php graduation design)
Based on php online learning platform management system acquisition (php graduation design)
2022-08-01 21:33:00 【Complete source code library】
基于phpOnline learning platform management system
The online learning platform management system is based onphp编程语言和mysql数据库开发,The system is divided into students,教师,管理员三个角色,After the students register and log in,Courses can be viewed,Play the lesson video,在线考试,Message to teachers and other functions;Teachers can manage courses after logging in,Manage exam papers and questions,View messages from students, etc;管理员对学生,教师,试卷,课程,Manage announcements, etc.本设计功能齐全,界面简洁,适合作为php毕业设计参考和学习.
一.技术环境
php版本:5.3 及以上
后台框架:无,phpNative development is simple and easy to understand
开发工具: notepad++,sublime,phpstorm都可
数据库: mysql
服务器: apache
集成环境: phpstudy(或其他)
详细技术:HTML+CSS+JS+PHP+MYSQL+PhpStudy
二.项目文件
三.系统功能
四.代码示例
package com.lmu.controller;
/** * 用户新增 */
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.lmu.model.Role;
import com.lmu.model.User;
import com.lmu.service.RoleService;
import com.lmu.service.UserService;
import com.lmu.utils.JsonUtils;
import com.lmu.utils.Pager;
import com.lmu.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import java.awt.event.FocusEvent;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller("userController")
@Scope("prototype")
public class UserController extends ActionSupport implements ModelDriven<User> {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
private User user;
private Integer userId;
private Map<String, Object> map = new HashMap();
/** * list * * @return */
public String list() throws IOException {
User user1 = UserUtils.getUser();
if (user1 == null || user1.getId() == null){
ActionContext.getContext().put("login", 1);
return SUCCESS;
}
Pager<User> pagers = null;
Role role = user1.getRole();
if (role.getEnName().equals("admin")) {
pagers = userService.getList(user);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("user", user1);
ActionContext.getContext().put("role", role);
ActionContext.getContext().put("bean", user);
return SUCCESS;
} else if (role.getEnName().equals("xs") || role.getEnName().equals("js")) {
pagers = userService.getList(user1);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("bean", user);
return SUCCESS;
}
return null;
}
/** * 跳转add * * @return */
public String add() {
Pager<Role> pagers = roleService.pagers();
ActionContext.getContext().put("pagers", pagers);
return SUCCESS;
}
/** * 查询修改 * * @return */
public String edit() {
User bean = userService.findById(userId);
Pager<Role> pagers = roleService.pagers();
ActionContext.getContext().put("bean", bean);
ActionContext.getContext().put("pagers", pagers);
return SUCCESS;
}
/** * 审核 * * @return */
public void updateSh() throws IOException {
user.setIsSh(1);
userService.updates(user);
map.put("flag", true);
map.put("url", "user_list.do");
JsonUtils.toJson(map);
}
/** * 更新 * * @return */
public String update() throws IOException {
if (user.getPass().equals("")){
user.setPass(null);
}
userService.updates(user);
map.put("flag", true);
map.put("url", "user_list.do");
JsonUtils.toJson(map);
return SUCCESS;
}
/** * 保存 * * @return */
public void save() throws IOException {
if (userService.getUser(user) != null){
map.put("flag", false);
map.put("url", "login_login.do");
JsonUtils.toJson(map);
} else {
user.setTime(new Date());
userService.save(user);
map.put("flag", true);
map.put("url", "login_login.do");
JsonUtils.toJson(map);
}
}
public void delete() throws IOException {
User user1 = userService.findById(userId);
user1.setIsDelete(1);
userService.update(user1);
map.put("flag", true);
map.put("url", "user_list.do");
JsonUtils.toJson(map);
}
@Override
public User getModel() {
if (user == null) {
user = new User();
}
return user;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
package com.lmu.controller;
/** * 和登陆有关的都在这里 */
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.lmu.model.Role;
import com.lmu.model.User;
import com.lmu.service.RoleService;
import com.lmu.service.UserService;
import com.lmu.utils.JsonUtils;
import com.lmu.utils.UserUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@Controller("loginController")
@Scope("prototype")
public class LoginController extends ActionSupport {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
private User user;
private Map<String, Object> map = new HashMap();
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
/** * 用户登陆 * @return */
public void index() throws IOException {
User user1 = userService.getUser(user);
if (user1 != null){
if (user1.getIsSh() == 1){
if (user1.getRole().getEnName().equals("admin")){
ActionContext.getContext().getSession().put("user", user1);
}
if (user1.getRole().getEnName().equals("js")){
ActionContext.getContext().getSession().put("user1", user1);
}
if (user1.getRole().getEnName().equals("xs")){
ActionContext.getContext().getSession().put("user2", user1);
}
map.put("flag", 1);
map.put("url", "login_indexs.do");
map.put("id", user1.getId());
JsonUtils.toJson(map);
} else {
map.put("flag", 2);
JsonUtils.toJson(map);
}
} else {
map.put("flag", 3);
JsonUtils.toJson(map);
}
}
public String indexs() throws IOException {
User u = UserUtils.getUser();
if (u != null){
ActionContext.getContext().put("user", u);
String ss = u.getRole().getEnName();
ActionContext.getContext().put("role", u.getRole().getEnName());
}
return SUCCESS;
}
//登陆页面
public String login() {
return SUCCESS;
}
//退出
public String tuichu() {
ActionContext ac = ActionContext.getContext();
Map session = ac.getSession();
session.remove("userName");
session.remove("userId");
ServletActionContext.getRequest().getSession().invalidate();
return "login";
}
}
五.项目截图
边栏推荐
- LVS负载均衡群集
- 测试开发人均年薪30w+?软件测试工程师如何进阶拿到高薪?
- Flink cluster construction
- 牛血清白蛋白刺槐豆胶壳聚糖缓释纳米微球/多西紫杉醇的纳米微球DTX-DHA-BSA-NPs
- ”sed“ shell脚本三剑客
- property语法
- C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
- 【Unity实战100例】文件压缩Zip和ZIP文件的解压
- [Chinese tree tags - CTB]
- Based on php online examination management system acquisition (php graduation design)
猜你喜欢
方舟开服需要知道的那些事
NFT的10种实际用途(NFT系统开发)
方舟:生存进化PVE模式和PVP模式
Realize the superposition display analysis of DWG drawing with CAD in Cesium
RecycleView的使用
Jmeter combat | Repeated and concurrently grabbing red envelopes with the same user
CS-NP白蛋白包覆壳聚糖纳米颗粒/人血清白蛋白-磷酸钙纳米颗粒无机复合材料
深拷贝浅拷贝
JS hoisting: how to break the chain of Promise calls
JS提升:如何中断Promise的链式调用
随机推荐
JS hoisting: how to break the chain of Promise calls
宝塔应用使用心得
WEB 渗透之端口协议
Realize the superposition display analysis of DWG drawing with CAD in Cesium
用户量大,Redis没法缓存响应,数据库宕机?如何排查解决?
基于php影视资讯网站管理系统获取(php毕业设计)
Port protocol for WEB penetration
上传markdown文档到博客园
分类接口,淘宝分类详情 API
Unity Shader 常规光照模型代码整理
How to make the timer not execute when the page is minimized?
附录A printf、varargs与stdarg A.3 stdarg.h ANSI版的varargs.h
LeetCode·32.最长有效括号·栈·动态规划
CS-NP白蛋白包覆壳聚糖纳米颗粒/人血清白蛋白-磷酸钙纳米颗粒无机复合材料
C专家编程 第1章 C:穿越时空的迷雾 1.3 标准I/O库和C预处理器
[Chinese tree tags - CTB]
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.3 The Standard I/O Library and the C Preprocessor
PyQt5 + MySQL5.8 【学生信息管理系统】【增删改查】
Day33 LeetCode
C Pitfalls and Defects Chapter 7 Portability Defects 7.9 Case Conversion