📄 function.asp
字号:
<%
function browser(info)
if Instr(info,"NetCaptor 6.5.0")>0 then
browser="NS 6.5.0"
elseIf InStr(info," Firefox/")>0 Then
browser="Mozilla Firefox"
ElseIf InStr(info," Firebird/")>0 Then
browser="Mozilla Firebird"
ElseIf InStr(info,"Maxthon")>0 Then
browser="Maxthon"
ElseIf InStr(info,"TencentTraveler")>0 Then
browser="腾讯浏览器"
elseif Instr(info,"MyIe 3.1")>0 then
browser="遨游 3.1"
elseif Instr(info,"NetCaptor 6.5.0RC1")>0 then
browser="NS 6.5.0RC1"
elseif Instr(info,"NetCaptor 6.5.PB1")>0 then
browser="NS 6.5.PB1"
elseif Instr(info,"MSIE 5.5")>0 then
browser="IE 5.5"
elseif Instr(info,"MSIE 6.0")>0 then
browser="IE 6.0"
elseif Instr(info,"MSIE 6.0b")>0 then
browser="IE 6.0b"
elseif Instr(info,"MSIE 5.01")>0 then
browser="IE 5.01"
elseif Instr(info,"MSIE 5.0")>0 then
browser="IE 5.00"
elseif Instr(info,"MSIE 4.0")>0 then
browser="IE 4.01"
else
browser="其它"
end if
end function
function system(info)
if Instr(info,"NT 5.1")>0 then
system=system+"Windows XP"
elseif Instr(info,"Tel")>0 then
system=system+"Telport"
elseif Instr(info,"webzip")>0 then
system=system+"webzip"
elseif Instr(info,"flashget")>0 then
system=system+"flashget"
elseif Instr(info,"offline")>0 then
system=system+"offline"
elseif Instr(info,"NT 5.2")>0 then
system=system+"Windows 2003"
elseif Instr(info,"NT 5")>0 then
system=system+"Windows 2000"
elseif Instr(info,"NT 4")>0 then
system=system+"Windows NT4"
elseif Instr(info,"98")>0 then
system=system+"Windows 98"
elseif Instr(info,"95")>0 then
system=system+"Windows 95"
elseif instr(info,"unix") or instr(info,"linux") or instr(info,"SunOS") or instr(info,"BSD") then
system=system+"类Unix"
elseif instr(thesoft,"Mac") then
system=system+"Mac"
else
system=system+"其它"
end if
end function
function YC_menu(menufile,menuput)
dim menu_temp
Set goxml=Server.CreateObject("Microsoft.XMLDOM")
goxml.load(Server.MapPath(menufile))
Set goroot=goxml.documentElement.selectSingleNode("menu")
m=0
for each child in goroot.childNodes
set childmenu=goroot.childnodes.item(m)
if menuput="head" then
if childmenu.getAttributeNode("mode").nodeValue=0 then
if childmenu.getAttributeNode("open").nodeValue=0 then
menu_temp=menu_temp&"┊<a href='"&goroot.childNodes.item(m).text&"'>"&childmenu.getAttributeNode("name").nodeValue&"</a>"
else
menu_temp=menu_temp&"┊<a href='"&goroot.childNodes.item(m).text&"' target='o'>"&childmenu.getAttributeNode("name").nodeValue&"</a>"
end if
end if
else
if childmenu.getAttributeNode("mode").nodeValue=1 then
if childmenu.getAttributeNode("open").nodeValue=0 then
menu_temp=menu_temp&"┊<a href='"&goroot.childNodes.item(m).text&"'>"&childmenu.getAttributeNode("name").nodeValue&"</a>"
else
menu_temp=menu_temp&"┊<a href='"&goroot.childNodes.item(m).text&"' target='o'>"&childmenu.getAttributeNode("name").nodeValue&"</a>"
end if
end if
end if
set childmenu=nothing
m=m+1
next
set goroot=nothing
set goxml=nothing
YC_menu=menu_temp
end function
function loadskin(skintype)
dim setskin,skindata,getskin,serverpath,skinfso
if request.cookies(webname&"skin")="" then
getskin=skin
else
getskin=request.cookies(webname&"skin")
end if
serverpath=server.mappath("skin/"&getskin&"/skin.asp")
if skintype<>1 then
set skinfso=server.createobject("scripting.filesystemobject")
if skinfso.fileexists(serverpath) then
set setskin=skinfso.opentextfile(serverpath,1,false)
if not setskin.atendofstream then
skindata=setskin.readall()
end if
setskin.close()
set setskin=nothing
end if
set skinfso=nothing
else
set setskin=server.createobject("adodb.stream")
setskin.type=2
setskin.mode=3
setskin.charset="gb2312"
setskin.open
setskin.loadfromfile(serverpath)
setskin.position=0
skindata=setskin.readtext(setskin.size)
setskin.close
set setskin=nothing
end if
loadskin=Mid(skindata,Instr(skindata,"%"&">")+2)
end function
function YC_Diyskin()
dim tmp
tmp=tmp&"<select onChange='if(this.selectedIndex&&this.selectedIndex!=0){location.href=this.value;}this.selectedIndex=0;'><option selected>自选风格</option>"
Set goxml=Server.CreateObject("Microsoft.XMLDOM")
goxml.load(Server.MapPath("inc/skin.xml"))
Set goroot=goxml.documentElement.selectSingleNode("skin")
m=0
for each child in goroot.childNodes
set childmenu=goroot.childnodes.item(m)
tmp=tmp&"<option value='skin.asp?go=skin&skin="&childmenu.getAttributeNode("url").nodeValue&"'>"&goroot.childNodes.item(m).text&"</option>"
set childmenu=nothing
m=m+1
next
set goroot=nothing
set goxml=nothing
tmp=tmp&"</select>"
YC_Diyskin=tmp
end function
function YC_count(tab,tabname)
dim YC_count_temp,YC_count_all,YC_count_nopass,YC_count_today,YC_count_yesterday
YC_count_all=conn.execute("select count(*) from "&tab&" where pass=1")(0)
YC_count_nopass=conn.execute("select count(*) from ["&tab&"] where pass=0")(0)
YC_count_today=conn.execute("select count(*) from ["&tab&"] where pass=1 and date>=#"&date()&"#")(0)
YC_count_yesterday=conn.execute("select count(*) from ["&tab&"] where pass=1 and date>=#"&date()-1&"#")(0)
YC_count_temp=YC_count_temp&"<ul class='list'>"
YC_count_temp=YC_count_temp&"<li>"&tabname&"总数:"&cint(YC_count_all)&"</li>"
YC_count_temp=YC_count_temp&"<li>待审更新:"&cint(YC_count_nopass)&"</li>"
YC_count_temp=YC_count_temp&"<li>今日更新:"&cint(YC_count_today)&"</li>"
YC_count_temp=YC_count_temp&"<li>昨日更新:"&cint(YC_count_yesterday-YC_count_today)&"</li>"
set rsclick=conn.execute("select sum(click) as myclick from ["&tab&"] where pass=1")
YC_count_temp=YC_count_temp&"<li>总浏览数:"&rsclick("myclick")&"</li>"
set rsclick=nothing
YC_count_temp=YC_count_temp&"</ul>"
YC_count=YC_count_temp
end function
Function bbimg(strText)
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
Dim s
s=strText
re.Pattern="<img(.[^>]*)>"
s=re.replace(s,"<img onclick=javascript:window.open(this.src); onload=javascript:resizepic(this) onmousewheel='return bbimg(this)' alt='点击在新窗口中打开图片' $1>")
response.Write s
End Function
Function page(a,b)
YC(" 共有"&a&""&rs.recordcount&""&b&",分"&mypage&"/"&rs.pagecount&"页,每页"&rs.pagesize&""&b&"。")
YC("<script language=""javascript"">")
YC("showPageLink(""?action=list&class="&request("class")&"&page="","&mypage&","&pages&");")
YC("</script>")
end Function
Function nextdata(tab,page,dw)
call br()
showid=request.querystring("id")
sql="select top 1 id,title,pass from "&tab&" where pass=true and id<"&showid&" order by id desc"
set rs=conn.execute(sql)
IF rs.eof and rs.bof Then
Response.Write(" 上一"&dw&":<font color=red>没有上一条记录</font>")
else
Response.Write(" 上一"&dw&":<a href="""&page&".asp?id="&rs("id")&""">"&rs("title")&"</a>")
end IF
rs.close
Set rs=Nothing
call br()
sql="select top 1 id,title,pass from "&tab&" where pass=true and id>"&showid&""
set rs=conn.execute(sql)
IF rs.eof and rs.bof Then
Response.Write(" 下一"&dw&":<font color=red>没有下一条记录</font>")
else
Response.Write(" 下一"&dw&":<a href="""&page&".asp?id="&rs("id")&""">"&rs("title")&"</a>")
end IF
rs.close
Set rs=Nothing
call br()
end Function
function YC_click(tab,url)
if request.querystring("class")<>"" then
sql="select id,title,click,date,class,user from ["&tab&"] where class="&request.querystring("class")&" and pass=1 order by click DESC"
else
sql="select id,title,click,date,class,user from ["&tab&"] order by click DESC"
end if
set rstop=server.createobject("adodb.recordset")
rstop.open sql,conn,1,1
n=0
YC("<ul class=""list"">")
do while not rstop.eof
YC("<li><a href='"&url&"?id="&rstop("id")&"' target='"&url&"' title='"&rstop("title")&"'>"&YC_cut(rstop("title"),20)&"</a></li>")
n=n+1
if n=clng(toplist) then exit do end if
rstop.movenext
loop
if rstop.eof and rstop.bof then
YC("<center>数据读取中...</center>")
end if
YC("</ul>")
rstop.close
set rstop=nothing
end function
function YC_best(tab,url)
if request.querystring("class")<>"" then
sql="select id,title,click,date,class,best,user from ["&tab&"] where best=1 and class="&request.querystring("class")&" and pass=1 order by id DESC"
else
sql="select id,title,click,date,class,best,user from ["&tab&"] where best=1 order by id DESC"
end if
set rsbest=server.createobject("adodb.recordset")
rsbest.open sql,conn,1,1
n=0
YC("<ul class=""list"">")
do while not rsbest.eof
YC("<li><a href='"&url&"?id="&rsbest("id")&"' target='"&url&"' title='"&rsbest("title")&"'>"&YC_cut(rsbest("title"),20)&"</a></li>")
n=n+1
if n=clng(bestlist) then exit do end if
rsbest.movenext
loop
if rsbest.eof and rsbest.bof then
YC("<center>数据读取中...</center>")
end if
YC("</ul>")
rsbest.close
set rsbest=nothing
end function
function js(tab,showpage,classdj,classid,titlelen,picmany,datamany)
YC("<table border='0'><tr><td width='136' align='center' valign='top'>")
if classdj=0 then
sql="select top "&picmany&" * from ["&tab&"] where pic<>'' and pass=1 and bigclass="&classid&" order by id DESC"
else
sql="select top "&picmany&" * from ["&tab&"] where pic<>'' and pass=1 and class="&classid&" order by id DESC"
end if
set rs=conn.execute(sql)
do while not rs.eof
YC("<div class='p1'><div class='p2'><div class='p3'>")
YC("<a href='show"&showpage&".asp?id="&rs("id")&"'><img src='"&rs("pic")&"' border='0' alt='"&rs("title")&"' style='width:120px;height:120px;border:1px solid #444' align='absmiddle'></a></div></div></div>")
YC("<center><a href='show"&showpage&".asp?id="&rs("id")&"' target='art'>"&YC_cut(rs("title"),16)&"</a></center>")
rs.movenext
loop
if rs.eof and rs.bof then
YC("<div class='p1'><div class='p2'><div class='p3'><img src='img/nopic.gif' style='width:120px;height:120px;border:#999 1px solid' /></div></div></div>")
call br()
YC("<center>暂时没有数据!</center>")
end if
rs.close
set rs=nothing
YC("</td><td valign='top' width='100%'>")
if classdj=0 then
sqllist="select top "&datamany&" * from ["&tab&"] where bigclass="&classid&" and pass=1 order by id DESC"
else
sqllist="select top "&datamany&" * from ["&tab&"] where class="&classid&" and pass=1 order by id DESC"
end if
set rs=conn.execute(sqllist)
if rs.eof and rs.bof then
YC("<br /><div align='center'>数据读取中...<br /><br /><img src='img/loading.gif' border='0' /></div>")
else
YC("<ul class='list'>")
do while not rs.eof
YC("<li>")
if classdj=0 then
YC("[")
call myclass(tab&"class",showpage,rs("class"))
YC("] ")
end if
YC("<a href='show"&showpage&".asp?id="&rs("id")&"'><font color='"&rs("color")&"' title='"&rs("title")&"'>"&YC_cut(rs("title"),titlelen)&"</font></a> ["&replacetime(rs("date"),"1")&"]")
if replacetime(rs("date"),"1")=date() then
YC(" <img src='img/new.gif' border='0'>")
end if
YC("</li>")
rs.movenext
loop
rs.close
set rs=nothing
YC("</ul>")
end if
YC("</td></tr></table>")
end function
function mybigclass(tab,url,myclassdj)
sqlclass="select id,classname from ["&tab&"] where id="&myclassdj&" order by id desc"
set rsclass=conn.execute(sqlclass)
if not rsclass.bof and not rsclass.eof then
response.Write "<a href="""&url&".asp?action=small&id="&rsclass("id")&""">"&rsclass("classname")&"</a>"
end if
rsclass.close
set rsclass=nothing
end function
function requestbigclass(tab,url,myclassdj)
sqlclass="select id,class from ["&tab&"] where id="&myclassdj&" order by id desc"
set rsclass=conn.execute(sqlclass)
YC(mybigclass(tab,url,rsclass("class")))
rsclass.close
set rsclass=nothing
end function
function myclass(tab,url,myclassdj)
sqlclass="select id,classname from ["&tab&"] where id="&myclassdj&" order by id desc"
set rsclass=conn.execute(sqlclass)
if not rsclass.bof and not rsclass.eof then
response.Write "<a href="""&url&".asp?action=list&class="&rsclass("id")&""">"&rsclass("classname")&"</a>"
end if
rsclass.close
set rsclass=nothing
end function
Function yecaoclass(tab,url)
sql="select id,classname from "&tab&" where class=0"
set rs=conn.execute(sql)
if not rs.bof and not rs.eof then
do while not rs.eof
set rs1=server.CreateObject("adodb.recordset")
sql1="select id,classname from "&tab&" where class="&rs("id")&""
rs1.open sql1,conn,1,1
YC(" <img alt='单击展开' src='img/+.gif' style='cursor:hand' onclick=""myopen('o"&rs("id")&"')""> ")
if request.querystring("action")="small" and request.querystring("id")=""&rs("id")&"" then
YC("<font color=red>"&rs("classname")&"</font><br>")
else
YC("<a href="""&url&".asp?action=small&id="&rs("id")&""">"&rs("classname")&"</a> (")
select case tab
case "YC_newsclass"
call classdata(1,"YC_news",rs("id"))
case "YC_artclass"
call classdata(1,"YC_art",rs("id"))
case "YC_downclass"
call classdata(1,"YC_down",rs("id"))
case "YC_picclass"
call classdata(1,"YC_pic",rs("id"))
case "YC_djclass"
call classdata(1,"YC_dj",rs("id"))
end select
YC(")<br />")
end if
YC("<div id=""o"&rs("id")&""" style=""display:none"">")
if not rs1.bof and not rs1.eof then
do while not rs1.eof
YC(" <img src='img/+-.gif'><img src='img/-.gif' align=absmiddle> ")
if request.querystring("class")=""&rs1("id")&"" then
YC("<font color=red>"&rs1("classname")&"</font>")
else
YC("<a href='"&url&".asp?action=list&class="&rs1("id")&"'>"&rs1("classname")&"</a>")
end if
YC(" (")
select case tab
case "YC_newsclass"
call classdata(2,"YC_news",rs1("id"))
case "YC_artclass"
call classdata(2,"YC_art",rs1("id"))
case "YC_downclass"
call classdata(2,"YC_down",rs1("id"))
case "YC_picclass"
call classdata(2,"YC_pic",rs1("id"))
case "YC_djclass"
call classdata(2,"YC_dj",rs1("id"))
end select
YC(")<br />")
rs1.movenext
loop
end if
YC("</div>")
rs1.close
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -