<%
Function newbbsNum() 
	tmprs=Conn.Execute("select count(*) from reply where datediff(day,posttime,getdate())=0")
   newbbsNum=tmprs(0) 
	Set tmprs=Nothing 
	if isnull(newbbsNum) Then newbbsNum=0 
End Function 

Function munthPhotoNum() 
	tmprs=Conn.Execute("select count(*) from photo where  datediff(month,uptime,getdate())=0")
   munthphotonum=tmprs(0) 
	Set tmprs=Nothing 
	if isnull(munthphotonum) Then munthphotonum=0 
End Function
 
Function waitPhotoNum() 
	tmprs=Conn.Execute("Select count(picid) from photo where passed=0") 
    waitPhotoNum=tmprs(0) 
	Set tmprs=Nothing 
	if isnull(waitPhotoNum) Then waitPhotoNum=0 
End Function 

Function nopassNum() 
	tmprs=Conn.Execute("Select count(id) from joinclass where isauditing=0") 
    nopassNum=tmprs(0) 
	Set tmprs=Nothing 
	if isnull(nopassNum) Then nopassNum=0 
End Function 


sub txlcount()
	if session("in")<>"in" then
		session("in")="in"
		application.lock
	    conn.execute("update [counter] set [count]=count+1,today=today+1")
	end if 

	sql="select * from [counter]"
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,3

	if formatdatetime(now(),2)<>formatdatetime(rs(2),2) then
		if rs(3)>rs(6) then
			rs(6)=rs(3)
		end if
		rs(5)=rs(3)
		rs(3)=1
		rs(4)=rs(4)+1
		rs(2)=formatdatetime(now(),2)
		rs.update
	end if

	dim s, i,g
	dim countlong,avg
	countlong=6
	avg=int(rs(0)\rs(4))
	g =CStr(rs(0))
	s =Len(g)

	response.write "总访问量：<a style=""CURSOR: hand""title=-------"&StrVar(1)&"-------&#13;&#10;"&_
	"　今日访问："&rs(3)&"人&#13;&#10;"&_
	"　昨日访问："&rs(5)&"人&#13;&#10;" &_
	"　最高日访问："&rs(6)&"人&#13;&#10;" &_
	"　平均日访问："&avg&"人&#13;&#10;"&_
	"　总访问人数："&rs(0)&"人&#13;&#10;"&_
	"　总统计天数："&rs(4)&"天&#13;&#10;"&_
	"　统计日期："&formatdatetime(rs(1),1)&"&#13;&#10;"&_
	"------------------------------------------"&_
	">"	

	For i = 1 to countlong - s
		response.write"<img src='images/counter/0.gif'></img>"
	next
	for i=1 to s
 		response.write "<img src='images/counter/" & mid(g,i,1) & ".gif'></img>"
	next
	response.write "</a><br>"
	rs.close
	set rs=nothing
end sub

Function onlineusers()

	Dim oSQL,oRs
	oSQL="Select count(userid) from online"
	Set oRs=conn.execute(oSQL)
	if oRs.eof and oRs.bof Then
		onlineusers=0
	Else
		onlineusers=oRs(0)
	End if
	Set oRs=Nothing

End Function

'友情链接
sub ShowFriendSite(LinkType,SiteNum,Cols,ShowType)
	dim sqlLink,rsLink,SiteCount,i,strLink
	if LinkType<>1 and LinkType<>2 then
		LinkType=1
	else
		LinkType=Cint(LinkType)
	end if
	if SiteNum<=0 or SiteNum>100 then
		SiteNum=10
	end if
	if Cols<=0 or Cols>20 then
		Cols=10
	end if
	if ShowType=1 then
		strLink=strLink & "<marquee id='LinkScrollArea' direction='left' scrolldelay='50' scrollamount='1' width='100%' height='35' onmouseover='this.stop();' onmouseout='this.start();'>"
	elseif ShowType=3 then
		strLink=strLink & "<select name='FriendSite' onchange=""if(this.options[this.selectedIndex].value!=''){window.open(this.options[this.selectedIndex].value,'_blank');}""><option value=''>友情文字链接站点</option>"
	end if
	if ShowType=1 or ShowType=2 then
		strLink=strLink & "<table width='100%' cellSpacing='5'><tr align='center'>"
	end if
	
	sqlLink="select top " & SiteNum & " * from FriendSite where IsOK=1 and LinkType=" & LinkType & " order by IsGood,id desc"
	set rsLink=server.createobject("adodb.recordset")
	rsLink.open sqlLink,conn,1,1
	if rsLink.bof and rsLink.eof then
		if ShowType=1 or ShowType=2 then
	  		for i=1 to SiteNum
				strLink=strLink & "<td><a href='FriendSiteReg.asp' target='_blank'>"
				if LinkType=1 then
					strLink=strLink & "<img src='images/main/nologo.jpg' width='88' height='31' border='0' alt='点击申请'>"
				else
					strLink=strLink & "点击申请"
				end if
				strLink=strLink & "</a></td>"
				if i mod Cols=0 and i<SiteNum then
					strLink=strLink
				end if
			next
		end if
	else
		SiteCount=rsLink.recordcount
		for i=1 to SiteCount
			if ShowType=1 or ShowType=2 then
			  if LinkType=1 then
				strLink=strLink & "<td width='88'><a href='" & rsLink("SiteUrl") & "' target='_blank' title='网站名称：" & rsLink("SiteName") & vbcrlf & "网站地址：" & rsLink("SiteUrl") & vbcrlf & "网站简介：" & rsLink("SiteIntro") & "'>"
				if rsLink("LogoUrl")="" or rsLink("LogoUrl")="http://" then
					strLink=strLink & "<img src='images/main/nologo.gif' width='88' height='31' border='0'>"
				else
					strLink=strLink & "<img src='" & rsLink("LogoUrl") & "' width='88' height='31' border='0'>"
				end if
				strLink=strLink & "</a></td>"
			  else
				strLink=strLink & "<td width='88'><a href='" & rsLink("SiteUrl") & "' target='_blank' title='网站名称：" & rsLink("SiteName") & vbcrlf & "网站地址：" & rsLink("SiteUrl") & vbcrlf & "网站简介：" & rsLink("SiteIntro") & "'>" & rsLink("SiteName") & "</a></td>"
			  end if
			  if i mod Cols=0 and i<SiteNum then
				strLink=strLink
			  end if
			else
				strLink=strLink & "<option value='" & rsLink("SiteUrl") & "'>" & rsLink("SiteName") & "</option>"
			end if
			rsLink.moveNext
		next
		if SiteCount<SiteNum and (ShowType=1 or ShowType=2) then
			for i=SiteCount+1 to SiteNum
				if LinkType=1 then
					strLink=strLink & "<td width='88'><a href='FriendSiteReg.asp' target='_blank'><img src='images/main/nologo.jpg' width='88' height='31' border='0' alt='点击申请'></a></td>"
				else
					strLink=strLink & "<td width='88'><a href='FriendSiteReg.asp' target='_blank'>点击申请</a></td>"
				end if
				if i mod Cols=0 and i<SiteNum then
					strLink=strLink
				end if
			next
		end if
	end if
	if ShowType=1 or ShowType=2 then
		strLink=strLink & "</tr></table>"
	end if
	if ShowType=1 then
		strLink=strLink & "</marquee>"
	elseif ShowType=3 then
		strLink=strLink & "</select>"
	end if
	response.write strLink
	rsLink.close
	set rsLink=nothing
end sub
%>