<title>自动保存/去掉重复ID和IP/准确按时存储/按IP升序(Sipo made for xia)v1</title>
还有多长时间<INPUT TYPE="text" NAME="mytime" id="mytime" size="60" value="">
<br>
<%
‘’www.dc9.cn sipo QQ17862153
‘’这是去掉重复ID,IP版13:15
‘’如果想按照ID排序就把orderby 改为name
on error resume next
dim nowstr
const TimeInterval=60
‘’设定时间间隔
‘’如果下载时间很慢,就写成120秒
Response.LCID=2052
const lResolve=6
‘’解析域名超时时间,秒
const lConnect=6
‘’连接站点超时时间,秒
const lSend=6
‘’发送数据请求超时时间,秒
const lReceive=40
‘’下载数据超时时间,秒
const myURL="http://bbs.pku.edu.cn/cgi-bin/bbsusr?to=*"
‘’const myURL="http://localhost/test.htm"
If isempty(application("mytime2")) then
nowstr=now()
application.Lock
application("mytime")=DateToStr(nowstr,"w,d m y H:I:S")
application("mytime2")=nowstr
application.unLock
ElseIf DateDiff("s",application("mytime2"),now)>TimeInterval then
response.write "时间重置"
nowstr=now()
application.Lock
application("mytime")=DateToStr(nowstr,"w,d m y H:I:S")
application("mytime2")=nowstr
application.unLock
Else
If DateDiff("s",application("mytime2"),now)>=TimeInterval then
application.Lock
addstr=DateAdd("s",TimeInterval,application("mytime2"))
application("mytime")=DateToStr(addstr,"w,d m y H:I:S")
application("mytime2")=addstr
application.unLock
End If
End If
Response.write "上次保存时间"&application("mytime2")
Response.write "<br>"
Response.write "下次保存时间"&DateAdd("s",TimeInterval,application("mytime2"))
Response.write "<br>"
Function DateToStr(DateTime,ShowType)
Dim DateMonth,DateDay,DateHour,DateMinute,DateWeek,DateSecond
Dim FullWeekday,shortWeekday,Fullmonth,Shortmonth,TimeZone1,TimeZone2
TimeZone1="+0800"
TimeZone2="+08:00"
FullWeekday=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
shortWeekday=Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
Fullmonth=Array("January","February","March","April","May","June","July","August","September","October","November","December")
Shortmonth=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
DateMonth=Month(DateTime)
DateDay=Day(DateTime)
DateHour=Hour(DateTime)
DateMinute=Minute(DateTime)
DateWeek=weekday(DateTime)
DateSecond=Second(DateTime)
If Len(DateMonth)<2 Then DateMonth="0"&DateMonth
If Len(DateDay)<2 Then DateDay="0"&DateDay
If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
Select Case ShowType
Case "Y-m-d"
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay
Case "Y-m-d H:I A"
Dim DateAMPM
If DateHour>12 Then
DateHour=DateHour-12
DateAMPM="PM"
Else
DateHour=DateHour
DateAMPM="AM"
End If
If Len(DateHour)<2 Then DateHour="0"&DateHour
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&" "&DateAMPM
Case "Y-m-d H:I:S"
If Len(DateHour)<2 Then DateHour="0"&DateHour
If Len(DateSecond)<2 Then DateSecond="0"&DateSecond
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&":"&DateSecond
Case "YmdHIS"
DateSecond=Second(DateTime)
If Len(DateHour)<2 Then DateHour="0"&DateHour
If Len(DateSecond)<2 Then DateSecond="0"&DateSecond
DateToStr=Year(DateTime)&DateMonth&DateDay&DateHour&DateMinute&DateSecond
Case "ym"
DateToStr=Right(Year(DateTime),2)&DateMonth
Case "d"
DateToStr=DateDay
Case "ymd"
DateToStr=Right(Year(DateTime),4)&DateMonth&DateDay
Case "mdy"
Dim DayEnd
select Case DateDay
Case 1
DayEnd="st"
Case 2
DayEnd="nd"
Case 3
DayEnd="rd"
Case Else
DayEnd="th"
End Select
DateToStr=Fullmonth(DateMonth-1)&" "&DateDay&DayEnd&" "&Right(Year(DateTime),4)
Case "w,d m y H:I:S"
DateSecond=Second(DateTime)
If Len(DateHour)<2 Then DateHour="0"&DateHour
If Len(DateSecond)<2 Then DateSecond="0"&DateSecond
DateToStr=shortWeekday(DateWeek-1)&","&DateDay&" "& Left(Fullmonth(DateMonth-1),3) &" "&Right(Year(DateTime),4)&" "&DateHour&":"&DateMinute&":"&DateSecond&" "&TimeZone1
Case "y-m-dTH:I:S"
If Len(DateHour)<2 Then DateHour="0"&DateHour
If Len(DateSecond)<2 Then DateSecond="0"&DateSecond
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&"T"&DateHour&":"&DateMinute&":"&DateSecond&TimeZone2
Case Else
If Len(DateHour)<2 Then DateHour="0"&DateHour
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
End Select
End Function
%>
[1]