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

📄 usergrzc.java

📁 BBS虚拟社区
💻 JAVA
字号:
package com.laoer.bbscs.user;import java.sql.*;import java.io.*;import java.util.*;import com.laoer.bbscs.db.*;import com.laoer.bbscs.txthtml.*;import com.laoer.bbscs.admin.BBSConf;/** * <p>Title: BBS-CS</p> * <p>Description: BBS-CS(BBS式虚拟社区系统)</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: loveroom.com.cn</p> * @author 龚天乙(laoer) * @version 3.0 */public class UserGRZC {  String SQL = "";  DbTrans DBSQL;  DoText myDoText;  ResultSet rs = null;  BBSConf myBBSConf;  public UserGRZC() {      this.DBSQL = new DbTrans();      this.myDoText = new DoText();      this.myBBSConf = new BBSConf();  }  public String getGRZCList(String strUserID) {      String strGRZCList = "";      String tabledarkcolor = myBBSConf.gettabledarkcolor();      String tablemaincolor = myBBSConf.gettablemaincolor();      SQL = "select ID,boardname,eboardname from board";      try {          rs = DBSQL.executeQuery(SQL);          while (rs.next()) {              strGRZCList += "<table width=93% border=0 align=center cellpadding=0 cellspacing=0>\n<tr>\n";              strGRZCList += "<td bgcolor="+ tablemaincolor +" height=20><b><font color=#FFFFFF>  "+myDoText.iso2gb(rs.getString("boardname"))+"("+myDoText.iso2gb(rs.getString("eboardname"))+")</font></b></td>\n";              strGRZCList += "</tr>\n<tr>\n";              strGRZCList += "<td bgcolor="+ tabledarkcolor +">\n";              strGRZCList += getGRZCListBorads(strUserID, rs.getString("ID"));              //strGRZCList += "<table width=100% border=0 cellpadding=1 cellspacing=1>\n";              //strGRZCList += "</table>\n";              strGRZCList += "</td>\n</tr>\n</table>\n";          }          rs.close();      }      catch (SQLException e){      }      return strGRZCList;  }  public String getGRZCListBorads(String strUserID, String strBoardID) {      String strGRZCListBoards = "";      String SQL1 = "";      ResultSet rs1 = null;      int counter = 0;      String tabledarkcolor = myBBSConf.gettabledarkcolor();      String tabletintcolor = myBBSConf.gettabletintcolor();      strGRZCListBoards += "<table width=100% border=0 cellpadding=1 cellspacing=1>\n";      SQL1 = "select ID,boardsname from boards where boardID="+ strBoardID;      try {          rs1 = DBSQL.executeQuery(SQL1);          while (rs1.next()) {              if (counter == 0) {                  counter = 4;                  strGRZCListBoards += "<tr bgcolor="+ tabletintcolor +">";              }              strGRZCListBoards += "<td width=25%>\n<div align=center>\n";              strGRZCListBoards += "<input type=\"checkbox\" name=\"zc\" value="+rs1.getInt("ID")+" "+ isChecked(strUserID, rs1.getString("ID")) +">"+ myDoText.iso2gb(rs1.getString("boardsname")) +"</div>\n";              strGRZCListBoards += "</td>\n";              if (counter == 1) {                  counter = 0;                  strGRZCListBoards += "</tr>\n";              }              else {                  counter = counter-1;              }          }          rs1.close();      }      catch (SQLException e){      }      strGRZCListBoards += "</table>\n";      return strGRZCListBoards;  }  public String isChecked(String strUserID, String strZCID) {      String SQL2 = "select count(*) as num_grzc from grzc where UID="+ strUserID +" and zc="+ strZCID;      ResultSet rs2 = null;      int num_grzc = 0;      String isChecked = "";      try {          rs2 = DBSQL.executeQuery(SQL2);          if (rs2.next()) {              num_grzc = rs2.getInt("num_grzc");          }          rs2.close();      }      catch (SQLException e){      }      if (num_grzc == 1) {          isChecked = "checked";      }      return isChecked;  }  public boolean inGRZC(String strUserID, String[] zc) {      SQL = "delete from grzc where UID="+ strUserID;      try {          DBSQL.executeUpdate(SQL);      }      catch (Exception e) {      }      int len = 0 ;      try {          len = java.lang.reflect.Array.getLength(zc);      }      catch (Exception e) {          len = 0;      }      if (len > 0) {          for (int i = 0;i < len;i++) {              SQL = "insert into grzc (UID,zc) values ('"+ strUserID +"','"+ zc[i] +"')";              try {                  DBSQL.executeUpdate(SQL);              }              catch (Exception e) {                  return  false;              }          }          return true;      }      else {          return false;      }  }  public boolean isMyZC(String strUserID,String bid) {      int mygrzcnum = 0;      SQL = "select count(*) as mygrzcnum from grzc where UID="+ strUserID +" and zc="+ bid;      try {          rs = DBSQL.executeQuery(SQL);          if (rs.next()) {              mygrzcnum = rs.getInt("mygrzcnum");          }          rs.close();      }      catch (Exception e) {      }      if (mygrzcnum != 0) {          return true;      }      else {          return false;      }  }  public boolean inMyGRZC(String strUserID,String bid) {      SQL = "insert into grzc (UID,zc) values ('"+ strUserID +"','"+ bid +"')";      try {          DBSQL.executeUpdate(SQL);          return true;      }      catch (Exception e) {          return false;      }  }  public void close() {      try {          DBSQL.close();      }      catch (SQLException e){      }      myBBSConf.close();  }}

⌨️ 快捷键说明

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