?? password_man.jsp
字號:
<!--
whilvydy 新聞發布系統
-->
<%@ page contentType="text/html; charset=GB2312" language="java" import="java.sql.*" errorPage="" %>
<%@ include file = "func/parameter.jsp" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<jsp:useBean id="password" scope="page" class="net.jspcn.db.DbConnect" />
<jsp:useBean id='oMD5' scope='page' class='net.jspcn.tool.MD5'/>
<jsp:useBean id='StrTool' scope='page' class='net.jspcn.tool.StringProcess'/>
<%
int user_power = Integer.parseInt((String) session.getValue("user_power"));
if (user_power<1)
response.sendRedirect("login.jsp");
String sql;
ResultSet rs;
String user_password_old = request.getParameter("user_password_old");
String user_password_new = request.getParameter("user_password_new");
String user_password_new1 = request.getParameter("user_password_new1");
if(user_password_new!=null && user_password_new1!=null&&user_password_old!=null)
{
if(user_password_new.equals(user_password_new1)&&user_password_new.length()>=6)
{
user_password_new = oMD5.getMD5ofStr(user_password_new);
user_password_old = oMD5.getMD5ofStr(user_password_old);
password.openConnection();
sql = "select count(*) as user_num from "+user_table+" where user_id="+session.getValue("user_id")+" and user_password='"+user_password_old+"'";
rs = password.executeQuery(sql);
rs.next();
if(Integer.parseInt(rs.getString("user_num"))==1)
{
sql = "update "+user_table+" set user_password = '"+user_password_new+"' where user_id ="+session.getValue("user_id");
password.executeQuery(sql);
String sql_in = "insert into "+logrecord_table+" (logrecord_id,user_name,operation_time,logrecord_operation) values('','"+session.getValue("user_name")+"',now(),'user change password successful')";
password.executeUpdate(sql_in);
%>
<script language=vbscript>
msgbox "操作成功!您的密碼已經修改"
</script>
<%
}
else {
%>您的原密碼好象不對耶!
<%
String sql_in = "insert into "+logrecord_table+" (logrecord_id,user_name,operation_time,logrecord_operation) values('','"+session.getValue("user_name")+"',now(),'user change password failed for old password is wrong')";
password.executeUpdate(sql_in);
}
}
else { %>
您兩次輸入的密碼不相同!<br>或你的新密碼太短
<%
}
}
%>
<%@ include file = "func/header.jsp" %>
<body>
<div align=center>
更改密碼
<form action="password_man.jsp" method=post name=form1 onsubmit="return formCheck()">
<table width="50%" border="1" cellspacing="0" cellpadding="2" bordercolor="#00CC66" borderColorDark="#FFFFFF" borderColorLight="#00CC66">
<tr>
<td><div align="right">輸入舊密碼</div></td>
<td><div align="left"><input name="user_password_old" type="password" class=input size="12" maxlength=20></div></td>
</tr>
<tr>
<td><div align="right">輸入新密碼</div></td>
<td><div align="left"><input name="user_password_new" type="password" class=input size="12" maxlength=20> </div></td>
</tr>
<tr>
<td><div align="right">確認新密碼</div></td>
<td><div align="left"><input name="user_password_new1" type="password" class=input size="12" maxlength=20></div></td>
</tr>
</table>
<br>
<input type=submit value="確 定" class=button> <input type=reset value="重 置" class=button>
</div>
</form>
<SCRIPT language=JavaScript>
function formCheck()
{
if(document.form1.user_password_old.value=="")
{
alert("請輸入您的舊密碼!");
document.form1.user_password_old.focus();
return false;
}
if(document.form1.user_password_new.value=="")
{
alert("請輸入您的新密碼!");
document.form1.user_password_new.focus();
return false;
}
if(document.form1.user_password_new1.value!=document.form1.user_password_new.value)
{
alert("您兩次輸入的密碼不同,請重新輸入!");
document.form1.user_password_new1.focus();
return false;
}
}
</SCRIPT>
<%@ include file = "func/footer.jsp" %>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -