⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profile.jsp

📁 jsp bbs源代码
💻 JSP
字号:
<%
/*##################################################################**
**#  LyBBS ver 1.2.b2 (1.2.beta-2版) / 凌云论坛 ver 1.2.b2         #**
**#                                                                #**
**#  版权所有: 凌云工作室 (原流星电脑工作室)                       #**
**#                                                                #**
**#  制作人  : 星语凌 『teddy (Yongshan Ye)』                      #**
**#                                                                #**
**#  主页地址: http://www.unix-now.com/lybbs   凌云论坛主页        #**
**#            http://www.ierp.info/lybbs      凌云论坛镜像站      #**
**#            http://horseye@sina.com/        凌云论坛支持信箱    #**
**#                                                                #**
**##################################################################*/
%>
<%@ include file="include/config.jsp"%>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ include file="include/connect.jsp"%>
<%
int db=0;
String tempSTR="",action="";
//用户cookie变量声明
int id=0,styleid=0,membergone=0;
String cookieid="",cookiename="",usermode="",cookiemode="";
//日期定义
int now_year=0,now_month=0,now_day=0,now_hour=0,now_minute=0,now_second=0;
String now_date="",now_time="";
//定义boardprepare.jsp中的变量
String onlineview="",dispview="",boardtitle="",boardname="",title="",version="",copyright="",support="",programmer="",programemail="",homename="",homeurl="",togb="1",status="",maintainreason="",announcement="1",boardurl="",showfastlogin="",dispborn="",styleQuery="";
//本页变量定义
int userid=0;
String emailsupport="",username="",password="",password2="",useremail="",sendpassword="0",errorinfo="",lostquestion="",lostanswer="";
boolean postok=false;
int infosopen=0;
%>
<%@ include file="include/boardprepare.jsp"%>
<%@ include file="include/style.jsp"%>
<%
rs=connect.executeQuery("select infosopen from style where adminselected='1'");
if(rs.next())
  infosopen=rs.getInt(1);
tempSTR=request.getParameter("action");
if(tempSTR!=null && !tempSTR.equals(""))
  action=tempSTR;
else action="lostpassword";
if(action.equals("show")) {
  tempSTR=request.getParameter("member");
  if(tempSTR!=null && !tempSTR.equals(""))
    username=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
  tempSTR=request.getParameter("memberid");
  if(tempSTR!=null && !tempSTR.equals(""))
    userid=Integer.parseInt(tempSTR);
}
else if(action.equals("step2")) {
  tempSTR=request.getParameter("sendpassword");
  if(tempSTR!=null && !tempSTR.equals(""))
    sendpassword=tempSTR;
  tempSTR=request.getParameter("username");
  if(tempSTR!=null && !tempSTR.equals(""))
    username=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
}
else if(action.equals("step3")) {
  tempSTR=request.getParameter("username");
  if(tempSTR!=null && !tempSTR.equals(""))
    username=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
  tempSTR=request.getParameter("lostanswer");
  if(tempSTR!=null && !tempSTR.equals(""))
    lostanswer=togb.equals("1")?connect.toGB(tempSTR):tempSTR;
}
%>
<!--//html from here-->
<%@ include file="include/head.jsp"%>
<script language="JavaScript">
function check() {
  if (document.step1.username.value=="") {
    alert("请输入您的用户名!\n注意:加*号的栏目必须填写!");
    document.step1.username.focus();
    return (false);
  }
}
</script>
<body <%=lbbody%>>
<%@ include file="include/userheader.jsp"%>
<p>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> align=center>
 <tr>
  <td width=30% rowspan=2 valign=top>
   <%@ include file="include/viceadbanner.jsp"%>
  </td>
  <td valign=top align=left>
     <font face="宋体" color=<%=fontcolormisc%>>
     <img src="images/closedfold.gif" border=0> <a href="index.jsp"><%=boardname%></a><br>
     <img src="images/bar.gif" border=0><img src="images/openfold.gif" border=0> 用户资料
     </font>
  </td>
 </tr>
</table>
<p>
<%
if(action.equals("show")) {
  if(infosopen==2 && (cookiemode.equals("0") || cookiemode.equals("1")))
    errorinfo="管理员设置了这个页面只有版主或副版主可以查看";
  else if(infosopen==1 && cookiemode.equals("1"))
    errorinfo="管理员设置了这个页面只有注册用户可以查看";
  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%> align=center><font color=<%=fontcolormisc%>><b>用户资料查看错误</b></font></td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>>
      <font color=<%=fontcolormisc%>>
       <b>关于查看资料出错的可能原因:</b>
       <ul>
        <li><b><%=errorinfo%></b>
       </ul>
      </font>
     </td>
    </tr>
   </table>
  </td>
 </tr>
</table>
<%
  }
  else {
    if(userid!=0) {
      rs=connect.executeQuery("select username from author where id="+userid);
      if(rs.next())
        username=rs.getString(1);
    }
%>
<%@ include file="include/userstats.jsp"%>
<%
  }
}
else if(action.equals("modify")) {
%>
<%@ include file="include/usermodify.jsp"%>
<%
}
else if(action.equals("lostpassword")) {
  rs=connect.executeQuery("select emailsupport from config where id=1");
  if(rs.next())
    emailsupport=rs.getString(1);
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
 <tr>
  <td>
   <table cellpadding=6 cellspacing=1 border=0 width=100%>
    <form action="profile.jsp" method="post" name=step1 onSubmit="return check()">
    <input type=hidden name=action value="step2">
    <tr>
     <td bgcolor=<%=miscbacktwo%> valign=middle colspan=2 align=center>
      <font color=<%=fontcolormisc%>><b>请输入您的用户名,我们可以将您的密码通过邮件发给您!</b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>><font color=<%=fontcolormisc%>>请输入您的用户名</font></td>
     <td bgcolor=<%=miscbackone%>><input type=text name="username">
     <a href="javascript:openScript('help.jsp?helpon=遗忘密码',500,400)"><img src="images/help_b.gif" border=0></a>
     </td>
    </tr>
<%
if(emailsupport.equals("1")) {
%>
    <tr>
     <td bgcolor=<%=miscbackone%>><font color=<%=fontcolormisc%>>本站支持发电子邮件</font></td>
     <td bgcolor=<%=miscbackone%>>
      <input type=checkbox name="sendpassword" value="1"> 如果想直接把密码发到您的电子信箱,请选中!
     </td>
    </tr>
<%
}
%>
     <td bgcolor=<%=miscbacktwo%> valign=middle colspan=2 align=center>
      <input type=submit name=submit value="提 交">
     </td>
    </tr>
    </form>
   </table>
  </td>
 </tr>
</table>
<%
}
else if(action.equals("step2")) {
  if(username.equals("客人") || username.equals("")) {
    out.println("<script>history.back();</script>");
  }
  else {
    if(sendpassword.equals("1")) {//如果选择了支持发送密码到用户的电子信箱
      rs=connect.executeQuery("select email,password from author where username='"+username+"'");
      if(rs.next()) {
        useremail=rs.getString(1);
        password=rs.getString(2);
      }
      if(password.equals(""))
        errorinfo="抱歉!无法查询用户名为 "+username+" 的密码!该用户还没有注册!";
      else if(useremail.equals(""))
        errorinfo="抱歉!您注册时没有填写您的电子信箱!无法发送您的密码!";
      else {
        connect.sendTo(useremail);
        connect.sendSubject("Your lybbs password !!!");
        connect.sendContent("Hello: "+username+"\n\nYour username is "+username+"\nYour passord is "+password);
        connect.sendMail();
        postok=true;
      }
%>
<table cellpadding=6 cellspacing=1 border=0 width=<%=tablewidth%> align=center>
 <tr>
  <td bgcolor=<%=miscbacktwo%> align=center>
    <font color=<%=fontcolormisc%>><b><%if(postok) out.println("密码已经发送到用户的信箱!");else out.println("密码发送错误!");%></b></font>
  </td>
 </tr>
 <tr>
  <td bgcolor=<%=miscbackone%>>
    <font color=<%=fontcolormisc%>>
<%
if(postok) {
%>
    具体情况:
    <ul>
     <li>密码已经发送成功,请到您的电子信箱<%=useremail%>取密码!
     <li>(因为网络的缘故,邮件传递可能会失败或有延迟!)
     <li><a href="index.jsp">返回论坛首页</a>
     <meta http-equiv="refresh" content="3; url=index.jsp">
    </ul>
<%
}
else {
%>
    <b>关于密码发送错误的详细原因:</b>
    <ul>
     <li><b><%=errorinfo%> </b>
     <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
    </ul>
    </font>
    <br><br>
    <center> &gt;&gt; <a href="javascript:history.go(-1)">返回上一页</a></center>
<%
}
%>
    </font>
  </td>
 </tr>
</table>
<%
    }
    else {//如果没有选择发送到电子信箱
      rs=connect.executeQuery("select lostquestion,lostanswer from author where username='"+username+"'");
      if(rs.next()) {
        lostquestion=rs.getString(1);
        lostanswer=rs.getString(2);
      }
      if(lostquestion.equals("") || lostanswer.equals("")) {//用户没有填写问题或答案
        errorinfo="您注册时没有填写密码提示问题或答案!无法继续!";
%>
<table cellpadding=6 cellspacing=1 border=0 width=<%=tablewidth%> align=center>
 <tr>
  <td bgcolor=<%=miscbacktwo%> align=center>
    <font color=<%=fontcolormisc%>><b>寻找密码失败!</b></font>
  </td>
 </tr>
 <tr>
  <td bgcolor=<%=miscbackone%>>
    <font color=<%=fontcolormisc%>>
    <b>关于密码寻找失败的详细原因:</b>
    <ul>
     <li><b><%=errorinfo%> </b>
     <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
    </ul>
    </font>
    <br><br>
    <center> &gt;&gt; <a href="javascript:history.go(-1)">返回上一页</a></center>
    </font>
  </td>
 </tr>
</table>
<%
      }
      else {
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
 <tr>
  <td>
   <table cellpadding=6 cellspacing=1 border=0 width=100%>
    <form action="profile.jsp" method="post">
    <input type=hidden name=action value="step3">
    <input type=hidden name=username value="<%=username%>">
    <tr>
     <td bgcolor=<%=miscbacktwo%> valign=middle colspan=2 align=center>
      <font color=<%=fontcolormisc%>><b>请输入您的密码提示答案!</b></font>
     </td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>><font color=<%=fontcolormisc%>>您注册时输入的密码提示问题</font></td>
     <td bgcolor=<%=miscbackone%>><B><%=lostquestion%></B></td>
    </tr>
    <tr>
     <td bgcolor=<%=miscbackone%>><font color=<%=fontcolormisc%>>请输入您的密码提示答案</font></td>
     <td bgcolor=<%=miscbackone%>><input type=text name="lostanswer"></td>
    </tr>
     <td bgcolor=<%=miscbacktwo%> valign=middle colspan=2 align=center>
      <input type=submit name=submit value="提 交">
     </td>
    </tr>
    </form>
   </table>
  </td>
 </tr>
</table>
<%
      }
    }
  }
}
else if(action.equals("step3")) {
  if(lostanswer.equals("")) {
    errorinfo="您没有填写密码提示问题或答案!两项都不能空!";
  }
  else {
    rs=connect.executeQuery("select password from author where username='"+username+"' and lostanswer='"+lostanswer+"'");
    if(rs.next()) {
      //成功!提供给用户密码
      password=rs.getString(1);
      postok=true;
    }
    else {
      //失败!抛出错误
      errorinfo="错误!您提供的用户名、密码提示问题、密码提示答案无法匹配!";
    }
  }
%>
<table cellpadding=6 cellspacing=1 border=0 width=<%=tablewidth%> align=center>
 <tr>
  <td bgcolor=<%=miscbacktwo%> align=center>
    <font color=<%=fontcolormisc%>><b><%if(postok) out.println("密码寻找成功!");else out.println("密码寻找错误!");%></b></font>
  </td>
 </tr>
 <tr>
  <td bgcolor=<%=miscbackone%>>
    <font color=<%=fontcolormisc%>>
<%
if(postok) {
%>
    具体情况:
    <ul>
     <li>您的注册帐号是 <font color=#ff0000><b><%=username%></b></font> 您的注册密码是 <font color=#ff0000><b><%=password%></b></font> !
     <li>可不要再忘记哟!^_^
     <li><a href="index.jsp">返回论坛首页</a>
    </ul>
<%
}
else {
%>
    <b>关于密码寻找失败的详细原因:</b>
    <ul>
     <li><b><%=errorinfo%> </b>
     <li>您是否需要查看<a href="javascript:openScript('help.jsp',500,400)">帮助文件</a>?
    </ul>
    </font>
    <br><br>
    <center> &gt;&gt; <a href="javascript:history.go(-1)">返回上一页</a></center>
<%
}
%>
    </font>
  </td>
 </tr>
</table>
<%
}
%>
<%@ include file="include/foot.jsp"%>
<%
rs.close();
connect.close();
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -