该用户从未签到 - UID
- 91380
- 帖子
- 42
- 精华
- 0
- 积分
- 42
- 威望
- 0
- 豪門币
- 98
- 贡献
- 0
- 注册时间
- 2012-12-19
- 最后登录
- 2013-5-7
- 在线时间
- 56 小时
|
取得远程的访问者的IP地址
String s2 = httpservletrequest.getHeader("User-Agent");
String s3 = httpservletrequest.getHeader("Referer");
String s4 = """ + s + """;
if(s1 == null)
s1 = "-";
if(s2 == null)
s2 = "-";
else
s2 = """ + s2 + """;
if(s3 == null)
s3 = "-";
else
s3 = """ + s3 + """;
return s1 + " [" + new Date() + "] " + s4 + " " + s3 + " " + s2;
}
private String stringDate(Calendar calendar) file://取得时间戳
{
String s = String.valueOf(calendar.get(1));
String s1 = String.valueOf(calendar.get(2));
if(s1.length() == 1)
s1 = "0" + s1;
s = s + s1;
s1 = String.valueOf(calendar.get(5));
if(s1.length() == 1)
s1 = "0" + s1;
return s + s1;
}wxkfp146.com. zzkfp146.com. bjkfp13.com.
private String getFileByUrl(Hashtable hashtable, String s)
{
for(Enumeration enumeration = hashtable.keys(); enumeration.hasMoreElements();)
file://hashtable的keys()方法返回了哈希表关键字的枚举,enumeration的hasMoreElements()方法测试枚举重是否还有其他元素
{
String s1 = (String)enumeration.nextElement();
file://让s1的值为enumeration的下一个元素值
if(s.equals(hashtable.get(s1)))//如果s的值为s1的值,则
return s1;//返回s1的值
}
return null;
}
private String getFirstSite(Hashtable hashtable)//取得第一个站点的名字
{
String s = (String)hashtable.get("dir");
File file = new File(s);
if(file == null)
return null;
String as[] = file.list();
Vector vector = getGraphFiles(as);
file://设置Vector向量变量来获取图形文件
if(vector.size() == 0)//如果没有图形文件,则返回空值
return null;
else
return getUrl(hashtable, (String)vector.elementAt(0));
}
private String getUrl(Hashtable hashtable, String s)//取得URL
{
String s1 = s.toLowerCase();//设置s1为s的小写形式
for(Enumeration enumeration = hashtable.keys(); enumeration.hasMoreElements();)
{
String s2 = (String)enumeration.nextElement();
if(s1.equals(s2.toLowerCase()))
return (String)hashtable.get(s2);
}
return null;
}shkfp146.com. qdkfp146.com. njkfp146.com.
private void outputBanner(String s, Hashtable hashtable, HttpServletResponse httpservletresponse)//输出banner广告
throws IOException//如果有错则抛出IOException错误
{
String s1 = (String)hashtable.get("dir") + s;
httpservletresponse.setHeader("Cache-control", "no-store");
httpservletresponse.setHeader("Pragma", "no-cache");
httpservletresponse.setDateHeader("Expires", 1L);
httpservletresponse.setContentType("image/" + s.substring(s.indexOf(".") + 1));
javax.servlet.ServletOutputStream servletoutputstream = httpservletresponse.getOutputStream();
dumpFile(s1, servletoutputstream);
servletoutputstream.flush();
servletoutputstream.close();
}
private boolean dumpFile(String s, OutputStream outputstream)
{
byte abyte0[] = new byte[4096];
boolean flag = true;
try
{
FileInputStream fileinputstream = new FileInputStream(s);
int i;
while((i = fileinputstream.read(abyte0)) != -1)
outputstream.write(abyte0, 0, i);
fileinputstream.close();
}
catch(Exception _ex)
{
flag = false;
}
return flag;
}
private Vector getGraphFiles(String as[])//获得图片文件
{
Vector vector = new Vector();
if(as == null)//如果as为空值,则返回vector中的值
return vector;
for(int i = 0; i < as.length; i++)//as.length为as[]数组长度
{
String s = as[i].toUpperCase();//设置图片文件文件名的每个字符为大写
if(isGraphFile(s))//如果为图片格式
vector.addElement(as[i]);//加入向量中
}
return vector;
}
private boolean isGraphFile(String stringFileName)
file://判断文件是否为图形格式
{
int i = stringFileName.indexOf(".");//
if(i <= 0 || i == stringFileName.length() - 1)
return false;
file://判断文件是否以GIF、JPG、JPEG或 PNG结尾
String stringExtendFileName1 = stringFileName.substring(i + 1);
return stringExtendFileName1.equals("GIF") || stringExtendFileName1.equals("JPG") || stringExtendFileName1.equals("JPEG") || stringExtendFileName1.equals("PNG");
}
private void errorMessage(String s, HttpServletResponse httpservletresponse)
throws IOException
{
httpservletresponse.setContentType("text/html");
PrintWriter out = httpservletresponse.getWriter();
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("
" + s + " ");
out.println("");
out.println("");
out.flush();
out.close();
}
private String getFromQuery(String strQuery, String strQuery1)
{
if(strQuery == null)
return "";
int i;
if((i = strQuery.indexOf(strQuery1)) < 0)
return "";
String strQuery2 = strQuery.substring(i + strQuery1.length());
if((i = strQuery2.indexOf("&")) < 0)
return strQuery2;
else
return strQuery2.substring(0, i);
}
public String getServletInfo()
{
return "旗帜广告系统 ,Wayne Zheng";
}
private static final String CPR = "?Wayne Zheng";
private static final String DEFAULT_SITE = "yesky.com";
private static final String BANNER_SESSION = "旗帜广告系统 ,Wayne Zheng";
private static final String DIR = "dir";
private static final String LOG = "log";
private static final String BANNERINDEX = "bi";
private static final String EDITED = "edited";
private static final String VIEW_POSTFIX = "v";
private static final String CLICK_POSTFIX = "c";
private static final String CONFIG = "config";
private static final String MODE = "mode";
private static final String ID = "id";
private static final int BUFFER_SIZE = 4096;
static String separator = "/";
private static Hashtable cfgs;
private static Hashtable logs; |
|