google就搜不出来我的title和里面的任何内容了
各位做后台时 记录每个页面的访问ip、地址并记录在数据库中 是怎么实现的
为什么我加了这些代码 google就搜不出来我的title和里面的任何内容了? (jsp)
<%
conn.Conn();
//访问IP
String Ip=request.getRemoteAddr();
//获取IP来源算法
String ip1,ip2,ip3,ip4;
int i=Ip.indexOf(".");
ip1=Ip.substring(0,i);
Ip=Ip.substring(i+1,Ip.length());
i=Ip.indexOf(".");
ip2=Ip.substring(0,i);
Ip=Ip.substring(i+1,Ip.length());
i=Ip.indexOf(".");
ip3=Ip.substring(0,i);
ip4=Ip.substring(i+1,Ip.length());
String Ipone=ip1;
String Iptwo=ip1+"."+ip2;
long IpOK;
IpOK=(long)Integer.valueOf(ip1).intValue()*256*256*256+Integer.valueOf(ip2).intValue()*256*256+Integer.valueOf(ip3).intValue()*256+Integer.valueOf(ip4).intValue();
String SIp="pp";
SIp=Long.toString(IpOK);
String sql="Select Top 1 country,city From sncms_ipaddress Where ip1<="+SIp+" and ip2>="+SIp+" Order By ip1";
ResultSet rs=conn.execute(sql) ;
String country="地区不详";
String city="地址不详";
if (rs.next())
{
country=rs.getString("country");
city=rs.getString("city");
}
if (city==null)
city="";
//统计用IP
Ip=request.getRemoteAddr();
//来源
String Reffer=request.getHeader("Referer");
String RootPath=request.getRealPath("/") ;
String URI=request.getRequestURI() ;
String sPath=request.getQueryString() ;
//分割操作系统等信息
String userAgent="";
userAgent=request.getHeader("User-Agent");
String Browser = "unknown";
String os = "unknown";
//浏览器
Browser=userAgent.split(";")[1].trim();
os =userAgent.split(";")[2].trim();
userAgent=userAgent.toLowerCase();
//操作系统
if (userAgent.indexOf("win") > -1)
{
if (userAgent.indexOf("windows nt 5.0") > -1 || userAgent.indexOf("winnt5.0") > -1)
{
os = "Windows 2000";
}
if (userAgent.indexOf("windows nt 5.1") > -1 || userAgent.indexOf("winnt5.1") > -1)
{
os = "Windows XP";
}
if (userAgent.indexOf("win16") > -1 || userAgent.indexOf("windows 3.") > -1)
{
os = "Windows 3.x";
}
}
//统计用代理
userAgent=request.getHeader("User-Agent");
//out.print("IP:"+Ip+"<br>");
//out.print("Reffer:"+Reffer+"<br>");
//out.print("Browser:"+Browser+"<br>");
//out.print("Os:"+os+"<br>");
//out.print("UserAgent:"+userAgent+"<br>");
//out.print("Country:"+country+"<br>");
//out.print("City:"+city+"<br>");
//out.print("RootPath:"+RootPath+"<br>");
//out.print("URI:"+URI+"<br>");
//out.print("sPath:"+sPath+"<br>");
String Uid="test";
//插入数据库
String ISQL=null;
ISQL="insert into SnCms_Logs (Uid,sPat,Pge,ref,Ip,Adr,Bro,Os,Age) values ('"+Uid+"','"+sPath+"','"+URI+"','"+Reffer+"', ";
ISQL=ISQL+"'"+Ip+"','"+country+city+"','"+Browser+"','"+os+"','"+userAgent+"')";
conn.update(ISQL);
%>