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

📄 forum.java

📁 一个小型bbs的源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
              strListElite += "<TR BGCOLOR=#999999>\n";              strListElite += "<TD COLSPAN=6 HEIGHT=1><SPACER HEIGHT=1 TYPE=block></TD>";              strListElite += "</TR>\n";              i++;              numelite++;          }          rs.close();      }      catch (SQLException e) {      }      //numelite++;      //i = numelite;      /*      if (pid != null && pid.length()>0 && pid.equals("0")) {          SQL = "select * from forum where board ="+rootid+" and jd = "+rootid +" order by id";      }      else {          SQL = "select * from forum where board ="+rootid+" and jd = "+bid +" order by id";      }      */      //SQL = "select * from forum where board ="+rootid+" and jd = "+bid +" order by id";      SQL = "select * from forum where jd = "+bid +" and jdpid = "+pid+" order by id";      try {          rs = DBSQL.executeQuery(SQL);          while (rs.next()) {          if ((i %= n)==1) {              tablecolor = "#ffffff";          }          else {              tablecolor = "#F2F2F2";          }              strListElite += "<TR BGCOLOR="+tablecolor+">\n";              strListElite += "<TD HEIGHT=20 WIDTH=5% ALIGN=center>\n";              strListElite += "<FONT FACE=Arial, Helvetica, sans-serif SIZE=1 COLOR=#999999>"+numelite+"</FONT>\n";              strListElite += "</TD>\n<TD WIDTH=5% ALIGN=center>\n";              strListElite += "<IMG SRC='images/file.gif' ALT=文件><INPUT TYPE=checkbox NAME=delelitefile value='"+ rs.getInt("id") +"'>\n";              strListElite += "</TD>\n<TD WIDTH=40% ALIGN=center>\n";              strListElite += "<A href='readelite.jsp?rootid="+rs.getInt("board")+"&recid="+rs.getInt("id")+"&bid="+rs.getInt("jd")+"'>"+myDoText.iso2gb(rs.getString("title"))+"</A>\n";              strListElite += "</TD>\n";              strListElite += "<TD WIDTH=15%  ALIGN=center>\n";              strListElite += rs.getString("name");              strListElite += "</TD>\n<TD WIDTH=15%  ALIGN=center>\n";              strListElite += rs.getString("doelitename");              strListElite += "</TD>\n";              strListElite += "<TD  ALIGN=center WIDTH=20%>"+rs.getString("doelitetime")+"</TD>\n";              strListElite += "</TR>\n";              strListElite += "<TR BGCOLOR=#CCCCCC><TD COLSPAN=6 HEIGHT=2><SPACER HEIGHT=1 TYPE=block></TD></TR>\n";              strListElite += "<TR BGCOLOR=#999999>\n";              strListElite += "<TD COLSPAN=6 HEIGHT=1><SPACER HEIGHT=2 TYPE=block></TD>";              strListElite += "</TR>\n";              numelite++;              i++;          }          rs.close();      }      catch (SQLException e) {      }      return strListElite;  }  public String getSelectEliteDir(String pid,String bid) {      String strSelectEliteDir = "";      SQL = "select * from elite where PID = "+pid+" and rootID="+bid;      try {          rs = DBSQL.executeQuery(SQL);          while (rs.next()) {              strSelectEliteDir += "<option value='"+rs.getInt("ID")+"'>"+myDoText.iso2gb(rs.getString("elitename"))+"</option>\n";          }          rs.close();      }      catch (SQLException e) {      }      return strSelectEliteDir;  }  public boolean addEliteDir(String pid,String bid,String elitename,String strUserName) {      SQL = "insert into elite (PID,rootID,elitename,createuser,zluser,elitetime) values ('"+pid+"','"+bid+"','"+elitename+"','"+strUserName+"','"+strUserName+"',now())";      try {          DBSQL.executeUpdate(SQL);          return true;      }      catch (SQLException e) {          return false;      }  }  public boolean inEliteDir(String fileInEliteDir,String[] delelitefile) {      int len = 0 ;      try {          len = java.lang.reflect.Array.getLength(delelitefile);      }      catch (Exception e) {          len = 0;      }      if (len > 0) {          for (int i = 0;i < len;i++) {              SQL = "update forum set jdpid = "+fileInEliteDir+ " where id = "+delelitefile[i];              try {                  DBSQL.executeUpdate(SQL);              }              catch (SQLException e) {                  return false;              }          }          return true;      }      else {          return false;      }  }  public boolean delElitefile(String[] delelitefile) {      int len = 0 ;      try {          len = java.lang.reflect.Array.getLength(delelitefile);      }      catch (Exception e) {          len = 0;      }      if (len > 0) {          for (int i = 0;i < len;i++) {              SQL = "update forum set jd = 0,jdpid = 0 where id = "+delelitefile[i];              try {                  DBSQL.executeUpdate(SQL);              }              catch (SQLException e) {                  return false;              }          }          return true;      }      else {          return false;      }  }  public boolean delEliteDir(String pid,String bid,String[] delelitedir) {      int numEliteInThisDir = 0;      int numEliteDirInThisDir = 0;      int len = 0 ;      try {          len = java.lang.reflect.Array.getLength(delelitedir);      }      catch (Exception e) {          len = 0;      }      if (len > 0) {          for (int i = 0;i < len;i++) {              SQL = "select count(*) as numEliteInThisDir from forum where jd = "+bid+" and jdpid = "+delelitedir[i];              try {                  rs = DBSQL.executeQuery(SQL);                  if (rs.next()) {                      numEliteInThisDir = rs.getInt("numEliteInThisDir");                  }                  rs.close();              }              catch (SQLException e) {              }              SQL = "select count(*) as numEliteDirInThisDir from elite where PID = "+delelitedir[i];              try {                  rs = DBSQL.executeQuery(SQL);                  if (rs.next()) {                      numEliteDirInThisDir = rs.getInt("numEliteDirInThisDir");                  }                  rs.close();              }              catch (SQLException e) {              }              if (numEliteDirInThisDir == 0 && numEliteInThisDir == 0) {                  SQL = "delete from elite where id = "+delelitedir[i];                  try {                      DBSQL.executeUpdate(SQL);                  }                  catch (SQLException e) {                      return false;                  }              }              else {                  return false;              }          }          return true;      }      else {          return false;      }      /*      int numEliteInThisDir = 0;      SQL = "select count(*) as numEliteInThisDir from forum where jdpid = "+pid+ "and jd = "+bid;      try {          rs = DBSQL.executeQuery(SQL);          if (rs.next()) {              numEliteInThisDir = rs.getInt("numEliteInThisDir");          }          rs.close();      }      catch (SQLException e) {      }      if (numEliteInThisDir==0) {                int len = 0 ;                try {                    len = java.lang.reflect.Array.getLength(delelitedir);                }                catch (Exception e) {                    len = 0;                }                if (len > 0) {                    for (int i = 0;i < len;i++) {                    SQL = "delete from elite where id = "+delelitedir[i];                    try {                        DBSQL.executeUpdate(SQL);                    }                    catch (SQLException e) {                        return false;                    }                    }                    return true;                }                else {                    return false;                }      }      else {          return false;      }      */  }  public String listJinghua() {      DoDate myDate = new DoDate();      String strListJinghua = "";      String tablecolor = "";      int numelite = 1;      int i = 1;      int n = 2;      /*      if (pid != null && pid.length()>0 && pid.equals("0")) {          SQL = "select * from elite where PID = "+pid+" and  rootID="+rootid;      }      else {          SQL = "select * from elite where PID = "+bid+" and  rootID="+rootid;      }      */      SQL = "select * from board order by xu";      try {          rs = DBSQL.executeQuery(SQL);          while (rs.next()) {              if ((i %= n)==1) {                  tablecolor = "#ffffff";              }              else {                  tablecolor = "#F2F2F2";              }              strListJinghua += "<TR BGCOLOR="+tablecolor+">\n";              strListJinghua += "<TD HEIGHT=20 WIDTH=5% ALIGN=center>\n";              strListJinghua += "<FONT FACE=Arial, Helvetica, sans-serif SIZE=1 COLOR=#999999>"+numelite+"</FONT>\n";              strListJinghua += "</TD>\n<TD WIDTH=5% ALIGN=center>\n";              strListJinghua += "<IMG SRC='images/dir.gif' ALT=目录>\n";              strListJinghua += "</TD>\n<TD WIDTH=40% ALIGN=center>\n";              strListJinghua += "<A href='eliter.jsp?boardID="+rs.getInt("ID")+"'>"+myDoText.iso2gb(rs.getString("boardname"))+"</A>\n";              strListJinghua += "</TD>\n";              strListJinghua += "<TD WIDTH=15%  ALIGN=center>\n";              strListJinghua += "system";              strListJinghua += "</TD>\n<TD WIDTH=15%  ALIGN=center>\n";              strListJinghua += "system";              strListJinghua += "</TD>\n";              strListJinghua += "<TD  ALIGN=center WIDTH=20%><FONT COLOR=#999999>"+myDate.fotmatDate3(new java.util.Date())+"</FONT></TD>\n";              strListJinghua += "</TR>\n";              strListJinghua += "<TR BGCOLOR=#CCCCCC><TD COLSPAN=6 HEIGHT=2><SPACER HEIGHT=1 TYPE=block></TD></TR>\n";              strListJinghua += "<TR BGCOLOR=#999999>\n";              strListJinghua += "<TD COLSPAN=6 HEIGHT=1><SPACER HEIGHT=1 TYPE=block></TD>";              strListJinghua += "</TR>\n";              i++;              numelite++;          }          rs.close();      }      catch (SQLException e) {      }      return strListJinghua;  }  public String listEliter(String boardID) {      DoDate myDate = new DoDate();      String strEliter = "";      String tablecolor = "";      int numelite = 1;      int i = 1;      int n = 2;      SQL = "select * from boards where boardID = "+boardID+" and usestate = 1 order by xu";      try {          rs = DBSQL.executeQuery(SQL);          while (rs.next()) {              if ((i %= n)==1) {                  tablecolor = "#ffffff";              }              else {                  tablecolor = "#F2F2F2";              }              strEliter += "<TR BGCOLOR="+tablecolor+">\n";              strEliter += "<TD HEIGHT=20 WIDTH=5% ALIGN=center>\n";              strEliter += "<FONT FACE=Arial, Helvetica, sans-serif SIZE=1 COLOR=#999999>"+numelite+"</FONT>\n";              strEliter += "</TD>\n<TD WIDTH=5% ALIGN=center>\n";              strEliter += "<IMG SRC='images/dir.gif' ALT=目录>\n";              strEliter += "</TD>\n<TD WIDTH=40% ALIGN=center>\n";              strEliter += "<A href='elite.jsp?bid="+rs.getInt("ID")+"&pid=0'>"+myDoText.iso2gb(rs.getString("boardsname"))+"</A>\n";              strEliter += "</TD>\n";              strEliter += "<TD WIDTH=15%  ALIGN=center>\n";              strEliter += "system";              strEliter += "</TD>\n<TD WIDTH=15%  ALIGN=center>\n";              strEliter += "system";              strEliter += "</TD>\n";              strEliter += "<TD  ALIGN=center WIDTH=20%><FONT COLOR=#999999>"+myDate.fotmatDate3(new java.util.Date())+"</FONT></TD>\n";              strEliter += "</TR>\n";              strEliter += "<TR BGCOLOR=#CCCCCC><TD COLSPAN=6 HEIGHT=2><SPACER HEIGHT=1 TYPE=block></TD></TR>\n";              strEliter += "<TR BGCOLOR=#999999>\n";              strEliter += "<TD COLSPAN=6 HEIGHT=1><SPACER HEIGHT=1 TYPE=block></TD>";              strEliter += "</TR>\n";              i++;              numelite++;          }          rs.close();      }      catch (SQLException e) {      }      return strEliter;  }  public void close() {      try {          DBSQL.close();      }      catch (SQLException e) {      }  }}

⌨️ 快捷键说明

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