📄 change_save.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="../error/error.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改资料</title>
</head>
<link rel="stylesheet" type="text/css" href="../image/com.css"/>
<jsp:useBean id="login" class="useBean.Link_db" scope="page" />
<%
out.print("`");
String username=request.getParameter("username");
String password=request.getParameter("password");
String repassword=request.getParameter("repassword");
String email=request.getParameter("email");
String name=request.getParameter("name");
String sex=request.getParameter("sex");
String age=request.getParameter("age");
String homepage=request.getParameter("homepage");
String intro=request.getParameter("intro");
if(username==null||password==null||repassword==null||name==null){
out.println("<script>document.location='javascript:history.go(-1);'</script>");
}
username=login.chStr(username);
email=login.chStr(email);
name=login.chStr(name);
sex=login.chStr(sex);
homepage=login.chStr(homepage);
intro=login.chStr(intro);
String sqls=" SELECT * FROM associator WHERE 用户名='"+username+"'";
String sqlu=" UPDATE associator SET 密码='"+password+"',电子邮件='"+email+"',真实姓名='"+name+"',性别='"+sex+"',年龄='"+age+"',个人主页='"+homepage+"',自我介绍='"+intro+"' WHERE 用户名='"+username+"'";
int temp=-2;
temp=login.select(sqls);
if(temp>0){
/*查找当前用户资料*/
temp=0;
temp=login.update(sqlu);
if(temp>0){
out.print("<script>alert('修改成功');javascript:document.location='../mas/masview.jsp'</script>");
}else{
out.print("<script>alert('修改失败!');document.location='javascript:history.go(-1);'</script>");
}
}else{
out.print("<script>alert('用户名不存在');document.location='javascript:history.go(-1);'</script>");
}
%>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -