完整的访问统计程序(二 程序篇)
/*
原创:豆腐 请大家在转载和使用的时候 保留这条信息 */ /* dbcn.asp 创建数据库连接的 公用程序 */ <% function OpenConn() '创建数据库连接 dim ConnStr dim uid dim pwd dim db uid="BBC" pwd="BBC" db="BBC" Softserver="Softdepserver" Set Conn = Server.CreateObject("ADODB.Connection") ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & "" Conn.Open ConnStr set OpenConn=Conn end function function OpenRst() '创建数据库记录集 set Rst=Server.CreateObject ("ADODB.Recordset") set OpenRst=Rst end function %> /* staticFunc 统计程序所需要用到的函数库 */ <!--#include file="dbcn.asp"--> <% set conn=openConn() set rst=openRst() sub WriteDateTable(intStart,intEnd,strArray,ccount) '生成统计表 %> <table border=1 width=100%> <%for i= intStart to intEnd%> <tr> <td width=30%><%=strArray(i)%></td> <td width=60%> <% if rst.eof then setbar 0,ccount else if rst(1)=i then setbar rst(3),ccount if not rst.eof then rst.movenext else setbar 0,ccount end if end if %> </td> </tr> <%next%> </table> <% end sub %> <% sub setBar(num,ccount) '生成统计条 if ccount=0 then percent=0 else percent=cInt(num/ccount*10000)/100 end if strGif="bar.gif" %> <img src="<%=strGif%>" width="<%=percent+5%>" height=10><font color=red><%=percent%>%</font> <td align=center> 上一篇:一个基于ASP的标题广告管理系统(三) 下一篇:完整的访问统计程序(三 应用篇) 更多相关文章
|
推荐文章
精彩文章
|