48 lines
1.7 KiB
Plaintext
48 lines
1.7 KiB
Plaintext
|
<%@ page language="java" contentType="text/html; charset=GB18030"
|
|||
|
pageEncoding="GB18030" import="java.sql.*"%>
|
|||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|||
|
<jsp:useBean id="info" class="com.DB" scope="page" />
|
|||
|
<html>
|
|||
|
<head>
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
|
|||
|
<title>Insert title here</title>
|
|||
|
</head>
|
|||
|
<body>
|
|||
|
<%
|
|||
|
try {
|
|||
|
|
|||
|
String username=new String(request.getParameter("username").getBytes("ISO-8859-1"),"GB18030");
|
|||
|
String quanxian2=new String(request.getParameter("quanxian2").getBytes("ISO-8859-1"),"GB18030");
|
|||
|
String sql_password="select password from reg where username='"+username+"'";
|
|||
|
String password=info.GetRsValue(sql_password);
|
|||
|
System.out.println(password+"jsp===========password");
|
|||
|
|
|||
|
Connection con=info.getCon();
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>SQL<51><4C><EFBFBD><EFBFBD>
|
|||
|
String sql = "update reg set quanxian='"+quanxian2 +"' where username='"+username+"'";
|
|||
|
// <20><>ȡPreparedStatement
|
|||
|
PreparedStatement ps = con.prepareStatement(sql);
|
|||
|
int row = ps.executeUpdate();
|
|||
|
ps.executeUpdate();
|
|||
|
if(quanxian2.equals("<22><><EFBFBD><EFBFBD>Ա")){
|
|||
|
String sql2="insert into login (username,password) values ('" +username+ "','" +password+"')";
|
|||
|
int row2=info.GetCount(sql2);
|
|||
|
}else{
|
|||
|
String sql3="delete from login where username='"+username+"'";
|
|||
|
info.executeUpdate(sql3);
|
|||
|
}
|
|||
|
if(row > 0){
|
|||
|
|
|||
|
out.println("<script>alert('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>');window.location.href='quanxian_list.jsp';</script>");
|
|||
|
}
|
|||
|
// <20>ر<EFBFBD>PreparedStatement<6E><74><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>Դ
|
|||
|
ps.close();
|
|||
|
// <20>ر<EFBFBD>Connection<6F><6E><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>Դ
|
|||
|
con.close();
|
|||
|
} catch (Exception e) {
|
|||
|
out.print("<22><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
|
|||
|
e.printStackTrace();
|
|||
|
}
|
|||
|
%>
|
|||
|
</body>
|
|||
|
</html>
|