📄 usermodify.jsp
字号:
if(tempSTR!=null && !tempSTR.equals(""))
usersex=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("education");
if(tempSTR!=null && !tempSTR.equals(""))
usereducation=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("marry");
if(tempSTR!=null && !tempSTR.equals(""))
usermarry=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("work");
if(tempSTR!=null && !tempSTR.equals(""))
userwork=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("birthday");
if(tempSTR!=null && !tempSTR.equals(""))
userbirthday=tempSTR;
tempSTR=request.getParameter("usersx");
if(tempSTR!=null && !tempSTR.equals(""))
usersx=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
if(usersx.equals("blank"))
usersx="保密";
tempSTR=request.getParameter("astro");
if(tempSTR!=null && !tempSTR.equals(""))
userastro=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
if(userastro.equals("blank"))
userastro="保密";
tempSTR=request.getParameter("homepage");
if(tempSTR!=null && !tempSTR.equals(""))
userhomepage=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
else userhomepage="";
tempSTR=request.getParameter("qq");
if(tempSTR!=null && !tempSTR.equals(""))
userqq=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
else userqq="";
tempSTR=request.getParameter("icq");
if(tempSTR!=null && !tempSTR.equals(""))
usericq=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
else usericq="";
tempSTR=request.getParameter("country");
if(tempSTR!=null && !tempSTR.equals(""))
usercountry=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
else usercountry="";
tempSTR=request.getParameter("province");
if(tempSTR!=null && !tempSTR.equals(""))
userprovince=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("city");
if(tempSTR!=null && !tempSTR.equals(""))
usercity=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
else usercity="";
tempSTR=request.getParameter("timedifference");
if(tempSTR!=null && !tempSTR.equals(""))
usertimedifference=Integer.parseInt(tempSTR);
tempSTR=request.getParameter("introdution");
if(tempSTR!=null && !tempSTR.equals("")) {
userintrodution=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
userintrodution=connect.toBr(userintrodution);//转化html字符
}
else userintrodution="";
tempSTR=request.getParameter("signature");
if(tempSTR!=null && !tempSTR.equals("")) {
usersignature=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
usersignature=connect.toBr(usersignature);//转化html字符
//是否支持凌云标签
String firstcode="",replacefirstcode="",lastcode="",replacelastcode="";
rs=connect.executeQuery("select firstcode,replacefirstcode,lastcode,replacelastcode from lycode order by id");
while(rs.next()) {
firstcode=rs.getString(1);
replacefirstcode=rs.getString(2);
lastcode=rs.getString(3);
replacelastcode=rs.getString(4);
usersignature=connect.Replace(usersignature,firstcode,replacefirstcode);
usersignature=connect.Replace(usersignature,lastcode,replacelastcode);
}
usersignature=connect.toLyCode(usersignature);
}
else usersignature="";
tempSTR=request.getParameter("useravatar");
if(tempSTR!=null && !tempSTR.equals("") && !tempSTR.equals("noavatar"))
userimage=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
tempSTR=request.getParameter("imageurl");
if(tempSTR!=null && !tempSTR.equals("")) {
userimageurl=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
userimageurl=connect.Replace(userimageurl,"\'","");
userimageurl=connect.Replace(userimageurl,"\"","");
}
else userimageurl="";
tempSTR=request.getParameter("imagewidth");
if(tempSTR!=null && !tempSTR.equals(""))
userimagewidth=Integer.parseInt(tempSTR);
tempSTR=request.getParameter("imageheight");
if(tempSTR!=null && !tempSTR.equals(""))
userimageheight=Integer.parseInt(tempSTR);
rs=connect.executeQuery("select username from author where id="+cookieid);
if(rs.next()) {
username=rs.getString(1);
}
else username="";
if(useremail.equals("") || lostquestion.equals("") || lostanswer.equals(""))
errorinfo="资料填写不完整,电子邮件、密码提示问题和密码提示问题的答案都不能空!";
else if(useremail.indexOf("@")==-1)
errorinfo="电子邮件格式不对,请重新输入您的电子邮件!";
else if(connect.getRowNum("reservemail where reservemail='"+useremail+"'")>0)
errorinfo="您的电子邮件已经被保留,请重新输入您的电子邮件!";
else if(userintrodution.length()>maxinslegth)
errorinfo="您的个人简介太长,只允许有"+maxinslegth+"个字符";
else if(usersignature.length()>maxsignlegth)
errorinfo="您的个人签名,只允许有"+maxsignlegth+"个字符";
else if(!userimageurl.equals("") && (userimagewidth>maxposticonwidth || userimageheight>maxposticonheight))
errorinfo="用户自定义头像时,宽度不能超过"+maxposticonwidth+"象素和高度不能超过"+maxposticonheight+"象素!";
else if(username.equals(cookiename) && !username.equals("") && !username.equals("客人") && !username.equals("访客")) {
if(!password.equals("")) {
if(!password.equals(password2))
errorinfo="两次密码输入不一致!请重新输入!";
else if(password.length()<6)
errorinfo="您输入的密码太短,必须是六位以上!";
else {
if(userimageurl.equals("")) {
if(userimage.equals("blank"))
query="update author set password='"+password+"',email='"+useremail+"',showemail='"+usershowemail+"',lostquestion='"+lostquestion+"',lostanswer='"+lostanswer+"',newmembertitle='"+usermembertitle+"',newsocialpart='"+userpart+"',sex='"+usersex+"',education='"+usereducation+"',marry='"+usermarry+"',work='"+userwork+"',birthday='"+userbirthday+"',usersx='"+usersx+"',astro='"+userastro+"',homepage='"+userhomepage+"',qq='"+userqq+"',icq='"+usericq+"',country='"+usercountry+"',province='"+userprovince+"',city='"+usercity+"',timedifference="+usertimedifference+",introdution='"+userintrodution+"',signature='"+usersignature+"',imageurl='' where id="+cookieid;
else
query="update author set password='"+password+"',email='"+useremail+"',showemail='"+usershowemail+"',lostquestion='"+lostquestion+"',lostanswer='"+lostanswer+"',newmembertitle='"+usermembertitle+"',newsocialpart='"+userpart+"',sex='"+usersex+"',education='"+usereducation+"',marry='"+usermarry+"',work='"+userwork+"',birthday='"+userbirthday+"',usersx='"+usersx+"',astro='"+userastro+"',homepage='"+userhomepage+"',qq='"+userqq+"',icq='"+usericq+"',country='"+usercountry+"',province='"+userprovince+"',city='"+usercity+"',timedifference="+usertimedifference+",introdution='"+userintrodution+"',signature='"+usersignature+"',imagename='"+userimage+"',imageurl='' where id="+cookieid;
}
else {
query="update author set password='"+password+"',email='"+useremail+"',showemail='"+usershowemail+"',lostquestion='"+lostquestion+"',lostanswer='"+lostanswer+"',newmembertitle='"+usermembertitle+"',newsocialpart='"+userpart+"',sex='"+usersex+"',education='"+usereducation+"',marry='"+usermarry+"',work='"+userwork+"',birthday='"+userbirthday+"',usersx='"+usersx+"',astro='"+userastro+"',homepage='"+userhomepage+"',qq='"+userqq+"',icq='"+usericq+"',country='"+usercountry+"',province='"+userprovince+"',city='"+usercity+"',timedifference="+usertimedifference+",introdution='"+userintrodution+"',signature='"+usersignature+"',imagename='',imageurl=\""+userimageurl+"\",imagewidth="+userimagewidth+",imageheight="+userimageheight+" where id="+cookieid;
}
}
}
else {
if(userimageurl.equals("")) {
if(userimage.equals("blank"))
query="update author set email='"+useremail+"',showemail='"+usershowemail+"',lostquestion='"+lostquestion+"',lostanswer='"+lostanswer+"',newmembertitle='"+usermembertitle+"',newsocialpart='"+userpart+"',sex='"+usersex+"',education='"+usereducation+"',marry='"+usermarry+"',work='"+userwork+"',birthday='"+userbirthday+"',usersx='"+usersx+"',astro='"+userastro+"',homepage='"+userhomepage+"',qq='"+userqq+"',icq='"+usericq+"',country='"+usercountry+"',province='"+userprovince+"',city='"+usercity+"',timedifference="+usertimedifference+",introdution='"+userintrodution+"',signature='"+usersignature+"',imageurl='' where id="+cookieid;
else
query="update author set email='"+useremail+"',showemail='"+usershowemail+"',lostquestion='"+lostquestion+"',lostanswer='"+lostanswer+"',newmembertitle='"+usermembertitle+"',newsocialpart='"+userpart+"',sex='"+usersex+"',education='"+usereducation+"',marry='"+usermarry+"',work='"+userwork+"',birthday='"+userbirthday+"',usersx='"+usersx+"',astro='"+userastro+"',homepage='"+userhomepage+"',qq='"+userqq+"',icq='"+usericq+"',country='"+usercountry+"',province='"+userprovince+"',city='"+usercity+"',timedifference="+usertimedifference+",introdution='"+userintrodution+"',signature='"+usersignature+"',imagename='"+userimage+"',imageurl='' where id="+cookieid;
}
else {
query="update author set email='"+useremail+"',showemail='"+usershowemail+"',lostquestion='"+lostquestion+"',lostanswer='"+lostanswer+"',newmembertitle='"+usermembertitle+"',newsocialpart='"+userpart+"',sex='"+usersex+"',education='"+usereducation+"',marry='"+usermarry+"',work='"+userwork+"',birthday='"+userbirthday+"',usersx='"+usersx+"',astro='"+userastro+"',homepage='"+userhomepage+"',qq='"+userqq+"',icq='"+usericq+"',country='"+usercountry+"',province='"+userprovince+"',city='"+usercity+"',timedifference="+usertimedifference+",introdution='"+userintrodution+"',signature='"+usersignature+"',imagename='',imageurl=\""+userimageurl+"\",imagewidth="+userimagewidth+",imageheight="+userimageheight+" where id="+cookieid;
}
}
}
else {
errorinfo="无法确认用户身份!请确保您处在登录状态!如有问题请联系管理员!";
}
if(errorinfo.equals("") && !query.equals("")) {
//一切OK,准备更新用户资料
updateok=connect.executeUpdate(query);
}
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
<tr>
<td>
<table cellpadding=6 cellspacing=1 border=0 width=100%>
<tr>
<td bgcolor=<%=miscbacktwo%> valign=middle align=center>
<font face="宋体" color=<%=fontcolormisc%>><b><%if(updateok) out.println("您的个人信息已经成功修改"); else out.println("用户资料修改错误");%></b></font>
</td>
</tr>
<tr>
<td bgcolor=<%=miscbackone%> valign=middle>
<font face="宋体" color=<%=fontcolormisc%>>
<%
if(updateok) {
%>
具体情况:
<ul>
<li><b>论坛用户个人资料已经成功修改</b>
<li><a href=index.jsp>返回论坛首页</a>
</ul>
<%
}
else {
%>
修改资料错误的原因:
<ul>
<li><b><%=errorinfo%></b>
</ul>
修改资料错误的可能原因:
<ul>
<li>您还没有登录
<li>您不是<a href=register.jsp>注册</a>用户
</ul>
<br><br>
<center> << <a href="javascript:history.go(-1)">返回上一页</a></center>
<%
}
%>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
}
else if(!errorinfo.equals("")) {
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
<tr>
<td>
<table cellpadding=6 cellspacing=1 border=0 width=100%>
<tr>
<td bgcolor=<%=miscbacktwo%> valign=middle align=center>
<font face="宋体" color=<%=fontcolormisc%>><b>用户资料修改错误</b></font>
</td>
</tr>
<tr>
<td bgcolor=<%=miscbackone%> valign=middle>
<font face="宋体" color=<%=fontcolormisc%>>
修改资料错误的原因:
<ul>
<li><b><%=errorinfo%></b>
</ul>
修改资料错误的可能原因:
<ul>
<li>您还没有登录
<li>您不是<a href=register.jsp>注册</a>用户
</ul>
<br><br>
<center> << <a href="javascript:history.go(-1)">返回上一页</a></center>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -