📄 update_password_action.jsp
字号:
<%@ page contentType="text/vnd.wap.wml; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.wap.common.db.DBObject"%>
<%
request.setCharacterEncoding("UTF-8");
String nocache= String.valueOf(new java.util.Date().getTime())+"_time";
//获取登陆成功的用户序列ID
String idStr = request.getParameter("id");
String operStr = "";
System.out.println("idStr:"+idStr);
if(idStr == null || idStr.equals("")){
response.sendRedirect("index.jsp?nocache="+nocache); //返回首页重新登陆
}
String old_psw= request.getParameter("old_psw"); //旧密码
String new_psw1=request.getParameter("new_psw1"); //新密码
String new_psw2=request.getParameter("new_psw2"); //确认密码
try{
//首先解密序列ID
long private_key = (new java.util.Date()).getTime()/(1000*60*60*24);
int id = (int)(Long.parseLong(idStr) - private_key);
if(old_psw != null && new_psw1 != null && new_psw2 != null && new_psw1.trim().equals(new_psw2.trim())){
try{
//创建数据库操作实体
DBObject db = new DBObject();
//首先判断用户跟旧密码是否正确
String sql = "select id from manycall_user where id = "+ id +" and pwd='"+old_psw.trim()+"'";
boolean bResult = db.executeQuery(sql);
if(bResult){
sql = "update manycall_user set pwd='"+new_psw1+"' where id = "+ id +" and pwd ='"+old_psw+"'";
System.out.println("修改密码的SQL:"+sql);
db.executeUpdate(sql);
operStr = "密码修改成功!";
}else{
operStr = "sorry,密码修改失败!";
}
}catch(Exception ex){
operStr = "sorry,密码修改失败!";
}
}else{
operStr = "sorry,密码修改失败!";
}
}catch(Exception ex){
ex.printStackTrace();
response.sendRedirect("index.jsp?nocache="+nocache); //返回首页重新登陆
}
%>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head>
<meta http-equiv="Cache-Control" content="max-age=3600"/>
</head>
<card id='mainCard' title='118166多方通话' >
<p align='center'><strong>118166多方通话-个人信息</strong></p>
<p>
<%=operStr %>
</p>
<p>
<anchor>返回<go href='user_info.jsp?id=<%=idStr %>&nocache=<%=nocache %>' ></go></anchor>
</p>
</card>
</wml>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -