📄 setup_security_info.jsp
字号:
<%@page contentType="text/html; charset=gb2312" language="java" errorPage="error.jsp"%>
<%@page import="com.suninformation.*,com.suninformation.user.*,com.suninformation.tools.*,java.sql.Date"%>
<%request.setCharacterEncoding("gb2312");%>
<html>
<head>
<title>安全设置 - 沈航网络</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Includes/user.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-image: url(Images/bg.jpg);
}
body,td,th {
font-size: 12px;
}
-->
</style>
<link href="Includes/im.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<%
String UserName = ParamUtils.getParameter(request, "username");
String sessionUserName = (String) session.getAttribute("userName");
int Type = ParamUtils.getIntParameter(request, "type", 1);
boolean Setupsecurity = ParamUtils.getBooleanParameter(request, "setupsecurity", false);
String Password = null;
String Question = null;
String Answer = null;
String SecurityCode = null;
String Email = null;
boolean errorLogin = true;
boolean errors = false;
boolean errorQuestion = false;
boolean errorAnswer = false;
boolean errorSecurityCode = false;
boolean errorPassword = false;
boolean errorEmail = false;
boolean succ = false;
//用户是否登陆了。{
if ("null".equals(UserName)) {
UserName = null;
}
if (UserName != null && sessionUserName != null) {
if (UserName.equals(sessionUserName)) {
errorLogin = false;
}
else {
errorLogin = true;
}
}
if (errorLogin) {
throw new UserNotFoundException("): Sorry,您可能还未登陆或已经超时了!<br>请重新<a href=\"login.jsp\">登陆</a>。");
}
User us = UserManager.getUserProxy().getUser(UserName);
if (us.getSecuritied() == 1) {
if(Type<2){
Type=2;
}
}
//页面处理部分
if (Setupsecurity && request.getMethod().equals("POST")) { //判断是否是非法进入
if (Type == 1) {
Password = ParamUtils.getParameter(request, "password");
Question = ParamUtils.getParameter(request, "question");
Answer = ParamUtils.getParameter(request, "answer");
SecurityCode = ParamUtils.getParameter(request, "securitycode");
Email = ParamUtils.getParameter(request, "email");
String errMsg = "<ui>";
if (Password == null) {
errorPassword = true;
}
if (Question == null || Question.length() > 30) {
errorQuestion = true;
}
if (Answer == null || Answer.length() > 30) {
errorAnswer = true;
}
if (SecurityCode == null || SecurityCode.length() > 16) {
errorSecurityCode = true;
}
if (Email == null || Email.indexOf("@") < 1 || Email.indexOf(".") < 1 || Email.length() > 50) {
errorEmail = true;
}
errors = errorPassword || errorQuestion || errorEmail || errorAnswer || errorSecurityCode;
if (!errors) {
if (CheckValue.md5(Password).equals(UserManager.getUserProxy().getUser(UserName).getPassword())) {
SecurityInfo si = UserManager.getUserProxy().getSecurityInfoProxy().createSecurityInfo(UserName, Email, SecurityCode, Question, Answer);
UserManager.getUserProxy().getUser(UserName).setSecuritied(1);
}
else {
throw new UnacceptableException("密码不正确。");
}
}
if (errors) {
if (errorSecurityCode) {
errMsg = errMsg + "<li>安全码输入错误。</li>";
}
if (errorPassword) {
errMsg = errMsg + "<li>密码输入错误。</li>";
}
if (errorEmail) {
errMsg = errMsg + "<li>电子邮件输入错误。</li>";
}
if (errorQuestion) {
errMsg = errMsg + "<li>提示问题输入错误。</li>";
}
if (errorAnswer) {
errMsg = errMsg + "<li>问题答案输入错误。</li>";
}
errMsg = errMsg + "</ui>";
throw new UnacceptableException(errMsg);
}
}
else if (Type == 2) {
SecurityCode = ParamUtils.getParameter(request, "securitycode");
String errMsg = "<ui>";
if (SecurityCode == null || SecurityCode.length() > 16) {
errorSecurityCode = true;
}
errors = errorSecurityCode;
if (!errors) {
SecurityInfo si = UserManager.getUserProxy().getSecurityInfoProxy().getSecurityInfo(UserName);
if (CheckValue.md5(SecurityCode).equals(si.getSecurityCode())) {
Question = si.getQuestion();
Answer = si.getAnswer();
Email = si.getSecurityEmail();
Type = 3;
}
else {
throw new UnacceptableException("安全码不正确。");
}
}
if (errors) {
if (errorSecurityCode) {
errMsg = errMsg + "<li>安全码输入错误。</li>";
}
errMsg = errMsg + "</ui>";
throw new UnacceptableException(errMsg);
}
}
else if (Type == 3) {
Question = ParamUtils.getParameter(request, "question");
Answer = ParamUtils.getParameter(request, "answer");
Email = ParamUtils.getParameter(request, "email");
String errMsg = "<ui>";
if (Question == null || Question.length() > 30) {
errorQuestion = true;
}
if (Answer == null || Answer.length() > 30) {
errorAnswer = true;
}
if (Email == null || Email.indexOf("@") < 1 || Email.indexOf(".") < 1 || Email.length() > 50) {
errorEmail = true;
}
errors = errorQuestion || errorEmail || errorAnswer;
if (!errors) {
SecurityInfo si = UserManager.getUserProxy().getSecurityInfoProxy().getSecurityInfo(UserName);
si.setAnswer(Answer);
si.setQuestion(Question);
si.setSecurityEmail(Email);
succ = true;
}
if (errors) {
if (errorEmail) {
errMsg = errMsg + "<li>电子邮件输入错误。</li>";
}
if (errorQuestion) {
errMsg = errMsg + "<li>提示问题输入错误。</li>";
}
if (errorAnswer) {
errMsg = errMsg + "<li>问题答案输入错误。</li>";
}
errMsg = errMsg + "</ui>";
throw new UnacceptableException(errMsg);
}
}
}
%>
<TABLE WIDTH=776 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD width="10" ROWSPAN=2> </TD>
<TD><IMG SRC="Images/WEB_Page1_14.jpg" WIDTH=766 HEIGHT=9 ALT=""></TD>
</TR>
<TR>
<TD background="Images/WEB_Page1_15.jpg"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" align="right"><font color="#747474"><a href="http://www.aoke2008.com" class="title">沈航首页</a>| <a href="#" class="title" onClick="JavaScript:window.external.addFavorite('http://www.aoke2008.com/','奥克资讯网');return false;">加入收藏</a> | <a href="#" class="title" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.aoke2008.com/')">设为首页</a> | 网站导航</font></td>
<td width="29"> </td>
</tr>
<tr>
<td width="19" valign="top"> </td>
<td width="192" valign="top"><img src="Images/111.jpg" width="188" height="73"><br>
</td>
<td width="526" valign="baseline"><table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td align="center"><a href="main.jsp?username=<%=UserName%>" class="title">个人帐户中心</a> - <a href="show_person_info.jsp?username=<%=UserName%>" class="title">显示个人信息</a> - <a href="modify_person_info.jsp?username=<%=UserName%>" class="title">修改个人信息</a> - <a href="modify_pwd.jsp?username=<%=UserName%>" class="title">修改密码</a> - <a href="setup_security_info.jsp?username=<%=UserName%>" class="title">安全设置</a> - <a href="<%=SunGlobal.getHelpHome()%>" class="title">用户手册</a> - <a href="logout.jsp" class="title">退出系统</a></td>
</tr>
</table></td>
<td valign="top"> </td>
</tr>
</table></TD>
</TR>
</table>
<TABLE WIDTH=776 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD width="10" ROWSPAN=2> </TD>
<TD><IMG SRC="Images/WEB_Page1_14.jpg" WIDTH=766 HEIGHT=9 ALT=""></TD>
</TR>
<TR>
<TD background="Images/WEB_Page1_15.jpg">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> </td>
<td width="29"> </td>
</tr>
<tr>
<td width="17" height="159" valign="top"> </td>
<td width="720" align="center" valign="top">
<%
if(Type==1) {
%>
<form action="" method="post" name="frmUserReg" id="frmUserReg">
<table width="652" height="24" border="0" cellpadding="0" cellspacing="0" class="td_downLine">
<tr>
<td width="15" class="td_downLine"> </td>
<td width="282" class="td_downLine">
<img src="Images/arrow_04.gif" width="7" height="7">
安全设置(下面各项必须全部填写)
</td>
<br>
</tr>
</table>
<table width="652" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="89" align="right" class="td_downLine">密码:</td>
<td width="183" class="td_downLine">
<input name="password" type="password" id="password3" maxlength="16" style="FONT-SIZE: 12px; WIDTH: 90">
</td>
<td width="360" class="td_downLine">
<table width="354" height="25" border="0" cellpadding="1" cellspacing="1">
<tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -