打印IP 来源

<%
String userAgent = request.getHeader("User-Agent");
if (userAgent != null && userAgent.indexOf("http") == -1 && userAgent.toLowerCase().indexOf("spider") == -1) {
String ip = request.getRemoteHost();
IpUtil ipUtil = new IpUtil();
String country = ipUtil.getCountry(ip);
String area = ipUtil.getArea(ip);
ip = ip + "(" + country + "-" + area + ")";
System.out.println(ip + "," + request.getRequestURI() + "?" + request.getQueryString()  + ", [" + userAgent + "]" );
}
%>

猜你喜欢

转载自wentao365.iteye.com/blog/2144361