大灰狼的ASP工具箱——防盗链、判断星期几

发表于:2007-06-30来源:作者:点击数: 标签:
防盗链 % http=Request.ServerVariables("HTTP_REFERER") http2=Cstr(Request.ServerVariables("SERVER_NAME")) if mid(http,8,len(http2))http2 then response.write "本站禁止从外部站点下载!" else response.redirect "download.doc" ‘’download.doc为
 

防盗链

<%
 http=Request.ServerVariables("HTTP_REFERER")
 http2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(http,8,len(http2))<>http2 then
   response.write "本站禁止从外部站点下载!"
else
   response.redirect "download.doc" ‘’download.doc为下载文件名
end if
%>

-------------------------------------------------------

判断星期几

<%
yue=month(date())
nian=year(date())
 thismon=nian&"-"&yue&"-1"
 nextmon=dateadd("m",1,thismon)
 tiancount=datediff("d",thismon,nextmon)  ‘’本月的天数

wek= Weekday(date())
select case wek
case 1
response.write "周日"
case 2
response.write "周一"
case 3
response.write "周二"
case 4
response.write "周三"
case 5
response.write "周四"
case 6
response.write "周五"
case 7
response.write "周六"
end select

yue=month(date())
nian=year(date())
 thismon=nian&"-"&yue&"-1"
 nextmon=dateadd("m",1,thismon)
 tiancount=datediff("d",thismon,nextmon)  ‘’本月的天数
dim wek,wekday
wek= Weekday(date())
select case wek
case 1
wekday= "周日"
case 2
wekday= "周一"
case 3
wekday= "周二"
case 4
wekday= "周三"
case 5
wekday= "周四"
case 6
wekday= "周五"
case 7
wekday= "周六"
end select

‘’response.write "本月共"&tiancount&"天,今天是"&wekday&"
%>

原文转自:http://www.ltesting.net