|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
SQLServer是基于服务器端的中型的数据库,可以适合大容量数据的应用,在功能上管理上也要比Access要强得多。在处理海量数据的效率,后台开发的灵活性,可扩展性等方面强大。*/
/*dbcn.asp
创立数据库毗连的公用程序
*/
<%
functionOpenConn()
创立数据库毗连
dimConnStr
dimuid
dimpwd
dimdb
uid="BBC"
pwd="BBC"
db="BBC"
Softserver="Softdepserver"
SetConn=Server.CreateObject("ADODB.Connection")
ConnStr="Provider=SQLOLEDB.1;UID="&uid&";PWD="&pwd&";database="&db&";server="&
Softserver&""
Conn.OpenConnStr
setOpenConn=Conn
endfunction
functionOpenRst()
创立数据库纪录集
setRst=Server.CreateObject("ADODB.Recordset")
setOpenRst=Rst
endfunction
%>
/*
staticFunc
统计程序所必要用到的函数库
*/
<!--#includefile="dbcn.asp"-->
<%
setconn=openConn()
setrst=openRst()
subWriteDateTable(intStart,intEnd,strArray,ccount)
天生统计表
%>
<tableborder=1width=100%>
<%fori=intStarttointEnd%>
<tr>
<tdwidth=30%><%=strArray(i)%></td>
<tdwidth=60%>
<%
ifrst.eofthen
setbar0,ccount
else
ifrst(1)=ithen
setbarrst(3),ccount
ifnotrst.eofthenrst.movenext
else
setbar0,ccount
endif
endif
%>
</td>
</tr>
<%next%>
</table>
<%
endsub
%>
<%
subsetBar(num,ccount)
天生统计条
ifccount=0then
percent=0
else
percent=cInt(num/ccount*10000)/100
endif
strGif="http://edu.cnzz.cn/NewsInfo/bar.gif"
%>
height=10></td>
-->
<td><%setbarRst("VisitCount"),TotalVisit%></td>
<tdwidth=5%></td>
</tr>
<%Rst.MoveNext%>
<%Next%>
</table>
<%
endsub
%>
<%
subInsertData(userid)
处置扫瞄者信息
ExecUserInfouserid
处置日统计
ExecDayStaticuserid
处置周统计
ExecWeekStaticuserid
处置月统计
ExecMonthStaticuserid
处置年统计
ExecYearStaticuserid
endsub
%>
<%
subExecUserInfo(userid)
处置扫瞄者信息
strRet=Request.ServerVariables("HTTP_USER_AGENT")
strArray=split(strRet,"(")
strRet=left(strArray(1),len(strArray(1))-1)
strArray=split(strRet,";")
strBrowserName=strArray(1)扫瞄器
strUseSystem=strArray(2)用户操纵体系
strPrPage=Request.ServerVariables("HTTP_REFERER")从何而来
ifstrPrPage=""then
strPrPage="http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables
("SCRIPT_NAME")
endif
strIPAddr=Request.ServerVariables("REMOTE_ADDR")用户IP地点
strSQL="insertintoAccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage)"
strSQL=strSQL&"values("&trim(userid)&",getDate(),"&trim(strIPAddr)&","
strSQL=strSQL&trim(strUseSystem)&","&trim(strBrowserName)&","&trim(strPrPage)&")"
conn.executestrSQL
endsub
%>
<%
subExecDayStatic(userid)
处置逐日的小时数据
strSQL="select*fromDateStaticwheredateid=datepart(dy,getdate())anduserid="&userid&""
setrst=openrst()
rst.openstrSQL,conn,3,3
ifrst.eofandrst.bofthen
strSQL="deletefromDateStaticwhereuserid="&userid&""
conn.executestrSQL
fori=0to23
strSQL="insertintoDateStaticvalues(datepart(dy,getdate()),"&cStr(i)&","&userid
&",0)"
conn.executestrSQL
next
endif
strSQL="updatedatestaticsetnum=num+1wheredateid=datepart(dy,getdate())andhourid=datepart
(hh,getdate())anduserid="&userid&""
conn.executestrSQL
endsub
%>
<%
subExecWeekStatic(userid)
处置每周的日数据
strSQL="select*fromWeekStaticwhereweekid=datepart(ww,getdate())anduserid="&userid&""
setrst=openRst()
rst.openstrSQL,conn,3,3
ifrst.eofandrst.bofthen
strSQL="deletefromWeekStaticwhereuserid="&userid&""
conn.executestrSQL
fori=0to6
strSQL="insertintoWeekStaticvalues(datepart(ww,getdate()),"&cStr(i)&","&userid
&",0)"
conn.executestrSQL
next
endif
strSQL="updateweekstaticsetnum=num+1whereweekid=datepart(ww,getdate())anddayid+1=datepart
(dw,getdate())anduserid="&userid&""
conn.executestrSQL
endsub
%>
<%
subExecMonthStatic(userid)
处置每个月的日数据
strSQL="select*fromMonthStaticwheremonthid=datepart(mm,getdate())anduserid="&userid&""
setrst=openRst()
rst.openstrSQL,conn,3,3
ifrst.eofandrst.bofthen
strSQL="deletefromMonthStaticwhereuserid="&userid&""
conn.executestrSQL
fori=1to31
strSQL="insertintoMonthStaticvalues(datepart(mm,getdate()),"&cStr(i)&","&userid
&",0)"
conn.executestrSQL
next
endif
strSQL="updatemonthstaticsetnum=num+1wheremonthid=datepart(mm,getdate())anddayid=datepart
(dd,getdate())"
conn.executestrSQL
endsub
%>
<%
subExecYearStatic(userid)
处置每一年的月数据
strSQL="select*fromYearStaticwhereyearid=datepart(yy,getdate())anduserid="&userid&""
setrst=openRst()
rst.openstrSQL,conn,3,3
ifrst.eofandrst.bofthen
strSQL="deletefromYearStaticwhereuserid="&userid&""
conn.executestrSQL
fori=1to12
strSQL="insertintoYearStaticvalues(datepart(yy,getdate()),"&cStr(i)&","&userid
&",0)"
conn.executestrSQL
next
endif
strSQL="updateYearStaticsetnum=num+1whereYearid=datepart(yy,getdate())andMonthid=datepart
(mm,getdate())anduserid="&userid&""
conn.executestrSQL
endsub
%>
减少客户内IT专业人才缺乏带来的影响。ASP的客户员工利用浏览器进入相关的应用软件,简单易用,无需专业技术支持。 |
|