📄 func_photo.asp
字号:
strNavigation=strNavigation & "</td></tr></table>"
response.write strNavigation
end if
rsNavigation.close
set rsNavigation=nothing
end sub
'=================================================
'过程名:ShowSiteCount
'作 用:显示站点统计信息
'参 数:无
'=================================================
sub ShowSiteCount()
dim sqlCount,rsCount
Set rsCount= Server.CreateObject("ADODB.Recordset")
sqlCount="select count(PhotoID) from Photo where Deleted=False"
rsCount.open sqlCount,conn,1,1
response.write "图片总数:" & rsCount(0) & "个<br>"
rsCount.close
sqlCount="select count(PhotoID) from Photo where Passed=False and Deleted=False"
rsCount.open sqlCount,conn,1,1
response.write "待审图片:" & rsCount(0) & "个<br>"
rsCount.close
sqlCount="select count(CommentID) from PhotoComment"
rsCount.open sqlCount,conn,1,1
response.write "评论总数:" & rsCount(0) & "条<br>"
rsCount.close
sqlCount="select count(SpecialID) from Special"
rsCount.open sqlCount,conn,1,1
response.write "专题总数:" & rsCount(0) & "个<br>"
rsCount.close
sqlCount="select count(" & db_User_ID & ") from " & db_User_Table & ""
rsCount.open sqlCount,Conn_User,1,1
response.write "注册用户:" & rsCount(0) & "名<br>"
rsCount.close
sqlCount="select sum(Hits) from Photo"
rsCount.open sqlCount,conn,1,1
response.write "图片查看:" & rsCount(0) & "人次<br>"
rsCount.close
set rsCount=nothing
end sub
'=================================================
'过程名:ShowPhoto
'作 用:分页显示图片标题等信息
'参 数:TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub ShowPhoto(TitleLen,strClassID)
if TitleLen<0 or TitleLen>200 then
TitleLen=50
end if
sqlPhoto="select P.PhotoID,P.ClassID,C.ClassName,L.LayoutFileName,P.PhotoName,P.PhotoUrl_Thumb,P.Author,P.AuthorEmail,P.Keyword,P.UpdateTime,P.Editor,P.Hits,P.DayHits,P.WeekHits,P.MonthHits,P.PhotoSize,P.OnTop,P.Elite,P.Passed,P.Stars,P.PhotoLevel,P.PhotoPoint from Photo P"
sqlPhoto=sqlPhoto & " inner join (PhotoClass C inner join Layout L on C.LayoutID=L.LayoutID) on P.ClassID=C.ClassID where P.Deleted=False and P.Passed=True "
'if SpecialID>0 then
' sqlPhoto=sqlPhoto & " and P.SpecialID=" & SpecialID
'end if
if instr(strClassID,",")>0 then
sqlPhoto=sqlPhoto & " and P.ClassID in (" & strClassID & ")"
else
sqlPhoto=sqlPhoto & " and P.ClassID=" & Clng(strClassID)
end if
if keyword<>"" then
select case strField
case "PhotoName"
sqlPhoto=sqlPhoto & " and P.PhotoName like '%" & keyword & "%' "
case "PhotoIntro"
sqlPhoto=sqlPhoto & " and P.PhotoIntro like '%" & keyword & "%' "
case "Author"
sqlPhoto=sqlPhoto & " and P.Author like '%" & keyword & "%' "
case "Editor"
sqlPhoto=sqlPhoto & " and P.Editor like '%" & keyword & "%' "
case else
sqlPhoto=sqlPhoto & " and P.PhotoName like '%" & keyword & "%' "
end select
end if
sqlPhoto=sqlPhoto & " order by P.OnTop,P.PhotoID desc"
Set rsPhoto= Server.CreateObject("ADODB.Recordset")
rsPhoto.open sqlPhoto,conn,1,1
if rsPhoto.bof and rsPhoto.eof then
totalput=0
response.Write("<br><li>没有任何图片</li>")
else
totalput=rsPhoto.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
call PhotoContent(TitleLen,false) 'false为不显示图片标题,true为显示---贫龙修改
else
if (currentPage-1)*MaxPerPage<totalPut then
rsPhoto.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsPhoto.bookmark
call PhotoContent(TitleLen,True)
else
currentPage=1
call PhotoContent(TitleLen,True)
end if
end if
end if
rsPhoto.close
set rsPhoto=nothing
end sub
'=================================================
'过程名:PhotoContent
'作 用:显示图片属性、标题、作者、更新日期、点击数等信息
'参 数:intTitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub PhotoContent(intTitleLen,ShowTitle)
dim i,strTemp,TitleStr
response.write "<table border='0' cellpadding='0' cellspacing='5'><tr>"
if rsPhoto.bof and rsPhoto.eof then
response.write "<td width='135' align='center'>没有图片</td>"
else
i=0
do while not rsPhoto.eof
if i>0 and i mod 4=0 then
response.write "</tr><tr>"
end if
response.Write "<td align='center' width='135'>"
response.write "<table border='0' cellspacing='0' cellpadding='0' align='center'><tr><td align='center'>"
response.write "<a href='Photo_Show.asp?PhotoID=" & rsPhoto("Photoid") & "' title='图片名称:" & rsPhoto("PhotoName") & vbcrlf & "图片大小:" & rsPhoto("PhotoSize") & "K" & vbcrlf & "作 者:" & rsPhoto("Author") & vbcrlf & "更新时间:" & rsPhoto("UpdateTime") & vbcrlf & "下载次数:今日:" & rsPhoto("DayHits") & " 本周:" & rsPhoto("WeekHits") & " 本月:" & rsPhoto("MonthHits") & " 总计:" & rsPhoto("Hits") & "' target='_blank'><img height='100' border='0' src='" & rsPhoto("PhotoUrl_Thumb") & "'></a>"
response.write "</td></tr>"
response.write "<tr><td colspan='2'><img src='images/yy1_03.gif' width='125' height='7'></td></tr></table>"
if ShowTitle=True then
response.write "<a href='Photo_Show.asp?PhotoID=" & rsPhoto("Photoid") & "' title='图片名称:" & rsPhoto("PhotoName") & vbcrlf & "图片大小:" & rsPhoto("PhotoSize") & "K" & vbcrlf & "作 者:" & rsPhoto("Author") & vbcrlf & "更新时间:" & rsPhoto("UpdateTime") & vbcrlf & "下载次数:今日:" & rsPhoto("DayHits") & " 本周:" & rsPhoto("WeekHits") & " 本月:" & rsPhoto("MonthHits") & " 总计:" & rsPhoto("Hits") & "' target='_blank'>" & gotTopic(rsPhoto("PhotoName"),intTitleLen) & "</a>"
end if
response.write "</td>"
i=i+1
if i>=MaxPerPage then exit do
rsPhoto.movenext
loop
end if
response.write "</tr></table>"
end sub
'=================================================
'过程名:ShowNewPhoto
'作 用:显示最近更新的图片
'参 数:PhotoNum ----最多显示多少个图片
' ShowTitle ----是否显示图片名称,True为显示,False为不显示
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub ShowNewPhoto(PhotoNum,ShowTitle,TitleLen)
dim sqlNew,rsNew,i
if PhotoNum>0 and PhotoNum<=100 then
sqlNew="select top " & PhotoNum
else
sqlNew="select top 10 "
end if
sqlNew=sqlNew & " P.PhotoID,P.PhotoName,P.PhotoUrl_Thumb,P.Author,P.Keyword,P.UpdateTime,P.Editor,P.Hits,P.DayHits,P.WeekHits,P.MonthHits,P.PhotoSize,P.PhotoLevel,P.PhotoPoint from Photo P where P.Deleted=False and P.Passed=True "
sqlNew=sqlNew & " order by P.PhotoID desc"
Set rsNew= Server.CreateObject("ADODB.Recordset")
rsNew.open sqlNew,conn,1,1
if TitleLen<0 or TitleLen>255 then TitleLen=100
response.write "<table border='0' cellpadding='0' cellspacing='5'><tr>"
if rsNew.bof and rsNew.eof then
response.write "<td width='135' align='center'>没有图片</td>"
else
i=0
do while not rsNew.eof
if i>0 and i mod 4=0 then
response.write "</tr><tr>"
end if
response.Write "<td align='center' width='135'>"
response.write "<table border='0' cellspacing='0' cellpadding='0' align='center'><tr><td align='center'>"
response.write "<a href='Photo_Show.asp?PhotoID=" & rsNew("Photoid") & "' title='图片名称:" & rsNew("PhotoName") & vbcrlf & "图片大小:" & rsNew("PhotoSize") & "K" & vbcrlf & "作 者:" & rsNew("Author") & vbcrlf & "更新时间:" & rsNew("UpdateTime") & vbcrlf & "下载次数:今日:" & rsNew("DayHits") & " 本周:" & rsNew("WeekHits") & " 本月:" & rsNew("MonthHits") & " 总计:" & rsNew("Hits") & "' target='_blank'><img height='100' border='0' src='" & rsNew("PhotoUrl_Thumb") & "'></a>"
response.write "</td></tr>"
response.write "<tr><td colspan='2'><img src='images/yy1_03.gif' width='125' height='7'></td></tr></table>"
if ShowTitle=True then
response.write "<a href='Photo_Show.asp?PhotoID=" & rsNew("Photoid") & "' title='图片名称:" & rsNew("PhotoName") & vbcrlf & "图片大小:" & rsNew("PhotoSize") & "K" & vbcrlf & "作 者:" & rsNew("Author") & vbcrlf & "更新时间:" & rsNew("UpdateTime") & vbcrlf & "下载次数:今日:" & rsNew("DayHits") & " 本周:" & rsNew("WeekHits") & " 本月:" & rsNew("MonthHits") & " 总计:" & rsNew("Hits") & "' target='_blank'>" & gotTopic(rsNew("PhotoName"),TitleLen) & "</a>"
end if
response.write "</td>"
i=i+1
rsNew.movenext
loop
end if
response.write "</tr></table>"
rsNew.close
set rsNew=nothing
end sub
'=================================================
'过程名:ShowTop
'作 用:显示累计下载TOP N,N由参数PhotoNum指定
'参 数:PhotoNum ----最多显示多少个图片
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub ShowTop(PhotoNum,TitleLen,strClassID)
dim sqlTop,rsTop
if PhotoNum>0 and PhotoNum<=100 then
sqlTop="select top " & PhotoNum
else
sqlTop="select top 10 "
end if
sqlTop=sqlTop & " P.PhotoID,P.PhotoName,P.PhotoVersion,P.Author,P.Keyword,P.UpdateTime,P.Editor,P.Hits,P.DayHits,P.WeekHits,P.MonthHits,P.PhotoSize,P.PhotoLevel,P.PhotoPoint from Photo S where P.Deleted=False and P.Passed=True "
if instr(strClassID,",")>0 then
sqlTop=sqlTop & " and P.ClassID in (" & strClassID & ")"
else
if CLng(strClassID)>0 then
sqlTop=sqlTop & " and P.ClassID=" & strClassID
end if
end if
sqlTop=sqlTop & " order by P.Hits desc,P.PhotoID desc"
Set rsTop= Server.CreateObject("ADODB.Recordset")
rsTop.open sqlTop,conn,1,1
if TitleLen<0 or TitleLen>255 then TitleLen=100
if rsTop.bof and rsTop.eof then
response.write "<li>今日没有下载</li>"
else
do while not rsTop.eof
response.Write "<li><a href='Photo_Show.asp?PhotoID=" & rsTop("Photoid") & "' title='图片名称:" & rsTop("PhotoName") & vbcrlf & "图片版本:" & rsTop("PhotoVersion") & vbcrlf & "图片大小:" & rsTop("PhotoSize") & "K" & vbcrlf & "作 者:" & rsTop("Author") & vbcrlf & "更新时间:" & rsTop("UpdateTime") & vbcrlf & "下载次数:今日:" & rsTop("DayHits") & " 本周:" & rsTop("WeekHits") & " 本月:" & rsTop("MonthHits") & " 总计:" & rsTop("Hits") & "' target='_blank'>" & gotTopic(rsTop("PhotoName"),TitleLen) & "</li><br>"
rsTop.movenext
loop
end if
rsTop.close
set rsTop=nothing
end sub
'=================================================
'过程名:ShowTopDay
'作 用:显示本日下载TOP N,N由参数PhotoNum指定
'参 数:PhotoNum ----最多显示多少个图片
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub ShowTopDay(PhotoNum,TitleLen)
dim sqlTop,rsTop
if PhotoNum>0 and PhotoNum<=100 then
sqlTop="select top " & PhotoNum
else
sqlTop="select top 10 "
end if
sqlTop=sqlTop & " S.PhotoID,S.PhotoName,S.PhotoVersion,S.Author,S.Keyword,S.UpdateTime,S.Editor,S.Hits,S.DayHits,S.WeekHits,S.MonthHits,S.PhotoSize,S.PhotoLevel,S.PhotoPoint from Photo S where S.Deleted=False and S.Passed=True And datediff('D',LastHitTime,now())<=0 order by S.DayHits desc,S.PhotoID desc"
Set rsTop= Server.CreateObject("ADODB.Recordset")
rsTop.open sqlTop,conn,1,1
if TitleLen<0 or TitleLen>255 then TitleLen=100
if rsTop.bof and rsTop.eof then
response.write "<li>今日没有下载</li>"
else
do while not rsTop.eof
response.Write "<li><a href='Photo_Show.asp?PhotoID=" & rsTop("Photoid") & "' title='图片名称:" & rsTop("PhotoName") & vbcrlf & "图片版本:" & rsTop("PhotoVersion") & vbcrlf & "图片大小:" & rsTop("PhotoSize") & "K" & vbcrlf & "作 者:" & rsTop("Author") & vbcrlf & "更新时间:" & rsTop("UpdateTime") & vbcrlf & "下载次数:今日:" & rsTop("DayHits") & " 本周:" & rsTop("WeekHits") & " 本月:" & rsTop("MonthHits") & " 总计:" & rsTop("Hits") & "' target='_blank'>" & gotTopic(rsTop("PhotoName"),TitleLen) & "</li><br>"
rsTop.movenext
loop
end if
rsTop.close
set rsTop=nothing
end sub
'=================================================
'过程名:ShowTopWeek
'作 用:显示本周下载TOP N,N由参数PhotoNum指定
'参 数:PhotoNum ----最多显示多少个图片
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
sub ShowTopWeek(PhotoNum,TitleLen)
dim sqlTop,rsTop
if PhotoNum>0 and PhotoNum<=100 then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -