📄 pswchk.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>淳.清凉花坊</title>
<meta name="keywords" content="淳.清凉花坊">
<meta name="description" content="淳.清凉花坊">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="/css/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style11 {color: #006633}
.style13 {
font-size: 12px;
color: #FFFFFF;
}
.style15 {
color: #660000;
font-size: 14px;
font-weight: bold;
}
.style16 {font-size: 12px}
.style17 {color: #006633; font-size: 12px; }
-->
</style>
<body>
<%! public String getString(String s)
{if(s==null) s="";
try {byte a[]=s.getBytes("ISO-8859-1");
s=new String(a);
}
catch(Exception e)
{}
return s;
} %>
<% //获取session值,以及防止非法访问本页面
String userid= (String)session.getAttribute("userid");
userid=getString(userid);
String password=request.getParameter("oldPsw");
password=getString(password);
String newPsw=request.getParameter("newPsw");
newPsw=getString(newPsw);
String newPsw2=request.getParameter("newPsw2");
newPsw2=getString(newPsw2);
Connection con=null;
Statement sql=null;
ResultSet rs=null;
try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); }
catch(ClassNotFoundException event) { }
try {
con=DriverManager.getConnection("jdbc:odbc:sun","sa","");
sql=con.createStatement();
String condition="select * from uuser where userid='"+userid+"' and password='"+password+"'";
rs =sql.executeQuery(condition);
if(rs.next())
{
String strSQL="UPDATE uuser SET password="+"'"+newPsw+"'"+"WHERE userid="+"'"+userid+"'";
sql.executeUpdate(strSQL);
%>
<script LANGUAGE="javascript">
alert("修改成功!");
window.location.href = "usercenter.jsp";
</script>
<%
}
con.close();
}
catch(SQLException e1) { }
%>
<script language="javascript">
alert("密码错误,请重新输入登陆密码!");
history.go(-1);
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -