⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_edit_uinfo_action.jsp

📁 自己编写的jsp+mysql论坛系统,带后台系统.不是很完善,但是功能是完整的
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GBK"
	pageEncoding="GBK"%>
<%@page import="java.util.*,java.io.*,java.sql.*"%>
<%@ include file="../conn.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=GBK">
		<title>Insert title here</title>
	</head>
	<body>
		<%
			if (null != session.getAttribute("adminlogin")) {
				try {
					String strDo = "";
					String id = "";
					String new_password = "";
					String new_email = "";

					if (null != request.getParameter("id"))
						id = request.getParameter("id");
					if (null != request.getParameter("password"))
						new_password = request.getParameter("password");
					if (null != request.getParameter("email"))
						new_email = request.getParameter("email");

					//接收空值时跳转到登录页面 防止用户直接访问本页面
					if (id.equals("")) {
						System.out.print(id + "\n");
						response.sendRedirect("../error.jsp");
					} else {
						strDo = "UPDATE " + tuinfo + " SET";
						//判断修改不同信息
						if ((!new_password.equals(""))
								&& (new_email.equals(""))) {
							strDo += " password=SHA('" + new_password
									+ "') WHERE id='" + id + "'";
							System.out.print(strDo + "\n");
							stmt.executeUpdate(strDo);
						}
						if ((!new_email.equals(""))
								&& (new_password.equals(""))) {
							strDo += " email='" + new_email + "' WHERE id='"
									+ id + "'";
							System.out.print(strDo + "\n");
							stmt.executeUpdate(strDo);
						}
						if ((!new_password.equals(""))
								&& (!new_email.equals(""))) {
							strDo += " password=SHA('" + new_password
									+ "'),email='" + new_email + "' WHERE id='"
									+ id + "'";
							System.out.print(strDo + "\n");
							stmt.executeUpdate(strDo);
							session.removeAttribute("login");
						}
						response.sendRedirect("admin_all_uinfo.jsp");
					}
				} catch (Exception e) {
					e.printStackTrace();
					response.sendRedirect("../error.jsp");
				} finally {
					stmt.close();
					conn.close();
				}
			} else {
				response.sendRedirect("../error.jsp");
			}
		%>
	</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -