📄 website.java
字号:
package com.laoer.bbscs.sysinfo;
import com.laoer.bbscs.db.*;
import java.sql.*;
import org.apache.log4j.*;
import com.laoer.bbscs.servlet.*;
/**
* <p>Title: 天乙社区V5.0</p>
* <p>Description: BBS-CS天乙社区V5.0</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: laoer.com</p>
* @author 龚天乙
* @version 5.0
*/
public class WebSite {
static Logger logger = Logger.getLogger(WebSite.class.getName());
static String LOAD_WEBSITE = "select * from website";
static String UPDATE_WEBSITE =
"update website set website = ?,webURL = ?,BadWords = ?";
public WebSite() {
}
public synchronized static String[] getWebSite() {
TranContext myDB = new TranContext();
String[] website = {
"BBS-CS", "WWW.LAOER.COM", ""};
ResultSet rs = null;
try {
String badWords = "";
myDB.prepareStatement(LOAD_WEBSITE);
rs = myDB.executeQuery();
if (rs.next()) {
website[0] = rs.getString("website");
website[1] = rs.getString("webURL");
badWords = rs.getString("BadWords");
if (badWords == null) {
badWords = "fuck,shit";
}
website[2] = badWords;
}
return website;
}
catch (SQLException e) {
logger.error(e);
return website;
}
finally {
try {
if (rs != null) {
rs.close();
}
}
catch (SQLException e) {
}
try {
if (myDB != null) {
myDB.close();
}
}
catch (SQLException e) {
}
myDB.freeCon();
}
}
public static int updateWebSite(String website, String webURL,
String badWords) {
TranContext myDB = new TranContext();
try {
myDB.prepareStatement(UPDATE_WEBSITE);
myDB.setString(1, website);
myDB.setString(2, webURL);
myDB.setString(3, badWords);
myDB.executeUpdate();
String[] websites = {
website, webURL, badWords};
Sys.WEBSITE = websites;
UpMsg aUpMsg = new UpMsg(1);
ServerSession.upMsg(aUpMsg);
return Sys.RESULT_RIGHT;
}
catch (SQLException e) {
logger.error(e);
return Sys.RESULT_OBJECTEXCEPTION;
}
finally {
try {
if (myDB != null) {
myDB.close();
}
}
catch (SQLException e) {
}
myDB.freeCon();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -