⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 detail.jsp

📁 采用JSP+Java Bean开发的基于MySQL数据库的计数器。 包含有动网165501条数据库。 可以限制每个用户记录的IP数
💻 JSP
字号:
<%
/**
* Title:Lerx计数器(JSP+MySQL)
* Description:含有动网最新IP数据库 165501条 2004年11月5日更新,我找到的最新的也最合适的就是这个了,花了些时间处理导入到MySQL里。
* Copyright: Copyright (c) 2005
* Company:www.lerx.com,www.5z.com.cn,www.huafang.com.cn
* @author:lzh@5z.com.cn() QQ:27723812
* @version 1.0
* 开发平台:红旗Linux4.1,JDK 1.5.0_04-b05,Tomcat 5.5.9,MySQL 3.23.58
* 完成时间:2005.12.2
*/
%>
<%@ page contentType="text/html;charset=gb2312" %>
<jsp:useBean id="replace" scope="page" class="forum.StrReplace" />
<%@ page import="java.io.*"%>
<%@ page import="java.util.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ include file="const.jsp" %>
<%@ include file="conn.jsp" %>

<%
String ps_id="",ps_SiteName="",ps_URL="",ps_SQLCmd="",ps_FromWhere="",ps_FromWhereHtml="",ps_IP="",ps_RemoteIP="",ps_referrer="";
long pl_InitIP=0,pl_CountIP=0,pl_AllIP=0,pl_ViewCount=0,pl_YestdodayIP=0,pl_TodayIP=0,pl_MaxIP=0,pl_TodayView=0,pl_YestodayView=0;
int pi_step=0,pi_IPAvg=0,pi_ViewAvg=0,pi_DateCount=0;
Date pd_now = new Date(),pd_MaxIPDate=new Date(99,1,1),pd_StartStatDate=new Date(99,1,1);
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-M-d H:mm:ss");

ps_RemoteIP = request.getRemoteAddr().trim();
ps_id = request.getParameter("id");
if (ps_id==null)
{
ps_id="";
}
else
{
ps_id=ps_id.trim();
}
ps_SQLCmd="select * from statuser where id='"+ps_id+"'"; 
rs=stmt.executeQuery(ps_SQLCmd);
if (rs.next())
{
ps_SiteName			=	rs.getString("SiteName");
ps_URL					=	rs.getString("url");
pl_InitIP				=	rs.getInt("InitIP");
pl_CountIP			=	rs.getInt("CoutIP");
pl_ViewCount		=	rs.getInt("ViewCount");
pl_YestdodayIP	=	rs.getInt("YestodayIP");
pl_TodayIP			=	rs.getInt("TodayIP");
pl_MaxIP				=	rs.getInt("MaxIP");
pl_TodayView		=	rs.getInt("TodayView");
pl_YestodayView	=	rs.getInt("YestodayView");
pd_MaxIPDate		=	rs.getDate("MaxIPDate");
pd_StartStatDate=	rs.getDate("CreateDate");
pl_AllIP = pl_InitIP+pl_CountIP;



pi_DateCount		=(int)(pd_now.getTime() - pd_StartStatDate.getTime())/(1000*60*60*24);
pi_DateCount++;
pi_IPAvg				=(int)(pl_CountIP/pi_DateCount);
pi_ViewAvg			=(int)(pl_ViewCount/pi_DateCount);
pl_ViewCount		+=pl_InitIP;
}
rs.close();
%>
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<%@ include file="./css.jsp" %>
<title><%=ps_SiteName%>网站统计</title>

</head>

<body  bgcolor="<%=ps_BgColor%>" text="#FFFFFF" link="#FFFFCC" vlink="#FFFFCC" alink="#CCCCFF">

<div align="center">
  <center>
  <table width="750" border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF">
    <tr>
      <td width="100%">
        <div align="center">
        	
        	
        	

        	
        	
        	
          <table border="0" cellpadding="0" cellspacing="0" width="100%">
          	  <tr>
          	  <td>
          	  	
          	  	<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
  	<tr bgcolor="<%=ps_TableColor%>">
    	<td width="100%" bgcolor="<%=ps_TableColor%>" height="5" colspan="3"></td>
    </tr>  
    <tr bgcolor="<%=ps_TableColor%>">
      <td width="19%"></td>
      <td width="61%" rowspan="2" valign="middle" align="center"><font color="#FFFFFF">【<a href="<%=ps_URL%>"><b><font color="#FFFFFF"><%=ps_SiteName%></font></b></a>】<b>网站访问统计</b></font></td>
      <td width="20%"></td>
    </tr>
    <tr bgcolor="<%=ps_TableColor%>">
      <td width="19%"></td>
      <td width="20%" align="right"></td>
    </tr>
  </table>
  </center>
</div>
          	  	
          	  	</td>
            </tr>
            <tr>
              <td width="100%" bgcolor="<%=ps_TableColor%>" height="5"></td>
            </tr>
            <tr>
              <td width="100%" align="center">
                
                	
                	 <table border="0"  bgcolor="#E1E1E1" cellpadding="0" cellspacing="0" width="100%" cellpadding="0">
                  	<tr>
      								<td>
                	
                	<div align="center">
                	
                  <table border="0"  bgcolor="#E1E1E1" cellpadding="0" cellspacing="0" width="96%" cellpadding="3">
                  	<tr>
      								<td width="100%" colspan="5" height="10"></td>
    								</tr>
                    <tr>
                      <td width="20%"><font color="#000000">总&nbsp;IP&nbsp;数:<%=pl_AllIP%></font></td>
                      <td width="20%"><font color="#000000">今日&nbsp;IP&nbsp;数:<%=pl_TodayIP%></font></td>
                      <td width="20%"><font color="#000000">昨日&nbsp;IP&nbsp;数:<%=pl_YestdodayIP%></font></td>
                      <td width="20%"><font color="#000000">平均&nbsp;IP&nbsp;数:<%=pi_IPAvg%></font></td>
                      <td width="20%"><font color="#000000">日最高IP数:<%=pl_MaxIP%></font></td>
                      
                    </tr>
                    <tr>
      								<td width="100%" colspan="5" height="3"></td>
    								</tr>
                    <tr>
                      <td width="20%"><font color="#000000">总浏览数:<%=pl_ViewCount%></font></td>
                      <td width="20%"><font color="#000000">今日浏览数:<%=pl_TodayView%></font></td>
                      <td width="20%"><font color="#000000">昨日浏览数:<%=pl_YestodayView%></font></td>
                      <td width="20%"><font color="#000000">平均浏览数:<%=pi_ViewAvg%></font></td>
                      <td width="20%"><font color="#000000">发生在:<%=pd_MaxIPDate%></font></td>
                      
                    </tr>
                      <tr>
      								<td width="100%" colspan="5" height="3"></td>
    								</tr>
                    <tr>
                      <td width="75%" colspan="3"><font color="#000000">服务器当前时间:<%=formatter.format(pd_now)%></font></td>

                      <td width="25%" colspan="2"><font color="#000000">开始统计日期:<%=pd_StartStatDate%></font></td>

                    </tr>

                      <tr>
      								<td width="100%" colspan="5" height="10"></td>
    								</tr>
                  </table>
                  
                   </div>
                  </td>
    								</tr>
                  </table>
                  
                  
               
              </td>
            </tr>
              <tr>
              <td width="100%" bgcolor="<%=ps_TableColor%>" height="5"></td>
            </tr>
            <tr bgcolor="<%=ps_TableColor%>">
              <td width="100%" align="center"><b><font color="#ffffff">最近50位访客记录</font></b></td>
            </tr>
            <tr>
              <td width="100%" bgcolor="<%=ps_TableColor%>" height="5"></td>
            </tr>
            <tr >
              <td width="100%">
              <%
              ps_SQLCmd="select * from ViewRec where userid='"+ps_id+"' order by ViewTime desc limit 0,50"; 
rs=stmt.executeQuery(ps_SQLCmd);
              %>
               <div align="center">
                  <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" width="100%" cellpadding="3">
                    <tr bgcolor="#E1E1E1">
                      <td width="6%" align="center"><font color="#0000FF">序号</font></td>
                      <td width="18%" align="center"><font color="#0000FF">时间及被访页面</font></td>
                      <td width="10%" align="center"><font color="#0000FF">IP地址</font></td>
                      <td width="20%" align="center"><font color="#0000FF">地区</font></td>
                      <td width="46%" align="center"><font color="#0000FF">访客来源</font></td>
                    </tr>
                    <%
                    while(rs.next()) {
                    pi_step++;
                    ps_FromWhere=rs.getString("fromwhere").trim();
                    ps_referrer=rs.getString("referrer").trim();
                    if (ps_FromWhere.length()>8)
                    {
                    ps_FromWhereHtml="<a href=# Title="+ps_FromWhere+">"+"<font color=\"#000000\">"+ps_FromWhere.substring(0,8)+"..."+"</font>"+"</a>";
                    }
                  	else
                  	{
                  	ps_FromWhereHtml="<font color=\"#000000\">"+ps_FromWhere+"</font>";
                  	}
                  	if (ps_referrer==null)
                  	{
                  	ps_referrer="";
                  	}
                  	if (ps_referrer.equals("")||ps_referrer.equals("null"))
                  	{
                  	ps_referrer="<font color=\"#000000\">"+ps_ReferrerNullMsg+"</font>";
                  	}
                  	else
                  	{
                  		if (ps_referrer.length()>50)
                  		{
                  		ps_referrer="<a target=\"_blank\" href="+ps_referrer+">"+"<font color=\"#000000\">"+ps_referrer.substring(0,50)+"..."+"</font>"+"</a>";
                  		}
                  		else
                  		{
                  		ps_referrer="<a target=\"_blank\" href="+ps_referrer+">"+"<font color=\"#000000\">"+ps_referrer+"</font>"+"</a>";
                  		}
                  	}
                    ps_IP=rs.getString("ip").trim();
                    
                    %>
                    <tr bgcolor="#E1E1E1">
                      <td width="6%"  align="center"><font color="#000000"><%=pi_step%></font></td>
                      <td width="18%"><a target=\"_blank\" href="<%=rs.getString("CurrentURL")%>"><font color="#000000"><%=formatter.format(rs.getTimestamp("ViewTime"))%></font></a></td>
                      <td width="10%"><%if (ps_RemoteIP.equals(ps_IP)){%><font color="#ff0000"><%}else{%><font color="#000000"><%}%><%=ps_IP%></font></td>
                      <td width="20%"><%=ps_FromWhereHtml%></td>
                      <td width="46%"><%=ps_referrer%></td>
                    </tr>
                    <%
                    }
                    rs.close();
                    %>
                  </table>
                </div>

              </td>
            </tr>
          </table>
        </div>
      </td>
    </tr>

  </table>
  <br>
    <table width="750" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF">
    	<tr>
  <td align="center" width="100%">
  	<%if (pb_RegAccess)
  	{
  	%>
  	<a href="./regstep1.jsp" target="_blank">申请记数器</a>
  	<%
  	}
  	%>
  	<a href="./login.jsp?id=<%=ps_id%>">管理登录</a>
  	  	</td>
  </tr>
    <tr>
  <td align="center" width="100%">
  	
  	<%@ include file="./copyright.jsp" %>
  	</td>
  </tr></table>
  </center>
</div>

</body>

</html>
<%@ include file="disconn.jsp" %>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -