注册 登录
编程论坛 ASP技术论坛

求一段关于时间的脚本代码

chenxingg 发布于 2007-08-22 10:10, 496 次点击
要实现的功能:要限制浏览者只能在规定的时间内浏览网站,或者网站内的某一页面,其他时间将不能浏览!
注意:时间的确定一定要与服务器的时间一致

谢谢
8 回复
#2
hmhz2007-08-22 10:26
<%
TimeA=date()&" 20-00-00"
TimeB=date()+1&" 8-00-00"

if now()>TimeA or now()<TimeB then
response.write "对不起,晚20点之后到早8点之前不允许访问"
end if
%>
#3
chenxingg2007-08-27 15:25
时间怎么确定是服务器的时间还是客户端的时间呢
#4
hmhz2007-08-27 15:27

这就是服务器时间

#5
chenxingg2007-08-27 15:33
若是客户端怎么写呢?
#6
hmhz2007-08-27 15:39

不能使用客户端时间,否则这个时间限制就没意义了

客户可以随意更改时间来访问,这样你的时间限制就名存实亡了

#7
chenxingg2007-08-27 15:44


谢谢


如果我要确定准确的日期怎么办呢?

比如要在2007年10月2日---2007年10月5日之间

#8
hmhz2007-08-27 15:51

<%
TimeA="2007-10-2"
TimeB="2007-10-5"

if date()>TimeA or date()<TimeB then
response.write "对不起,2007-10-2之后到2007-10-5之前不允许访问"
end if
%>

[此贴子已经被作者于2007-8-27 15:52:16编辑过]

#9
chenxingg2007-08-27 15:54
谢谢


1