📄 modifydate.asp
字号:
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
%>
<!--#Include File="../Conn.asp"-->
<%
Dim Hotel_CheckInDate, Hotel_CheckOutDate, Hotel_Rooms, Hotel_Person
If ComeURL = "" Then
Response.Write "0"
Call CloseConn()
Response.End()
End If
Select Case Action
Case "ModifyDate": Call ModifyDate()
Case "ModifyDate2": Call ModifyDate2()
End Select
Call CloseConn()
Sub ModifyDate()
Hotel_CheckInDate = Request("Change_CheckInDate")
Hotel_CheckOutDate = Request("Change_CheckOutDate")
Hotel_Rooms = ELClng(Request("Change_Rooms"))
Hotel_Person = ELClng(Request("Change_Person"))
If Not IsDate(Hotel_CheckInDate) Then Hotel_CheckInDate = Date()
If DateDiff("d", Date(), Hotel_CheckInDate)<1 Then Hotel_CheckInDate = Date()
If Not IsDate(Hotel_CheckOutDate) Then Hotel_CheckOutDate = DateAdd("d", 1, Hotel_CheckInDate)
If DateDiff("d", Hotel_CheckInDate, Hotel_CheckOutDate)<1 Then Hotel_CheckOutDate = DateAdd("d", 1, Hotel_CheckInDate)
If Hotel_Rooms < 1 Then Hotel_Rooms = 1
If Hotel_Person < 1 Then Hotel_Person = 1
Hotel_CheckInDate = FormatDate(Hotel_CheckInDate)
Hotel_CheckOutDate = FormatDate(Hotel_CheckOutDate)
Call SetCookie(EL_Sn, "Hotel_CheckInDate", Hotel_CheckInDate, 7)
Call SetCookie(EL_Sn, "Hotel_CheckOutDate", Hotel_CheckOutDate, 7)
Call SetCookie(EL_Sn, "Hotel_Rooms", Hotel_Rooms, 7)
Call SetCookie(EL_Sn, "Hotel_Person", Hotel_Person, 7)
Response.Write "1"
End Sub
Sub ModifyDate2()
Hotel_CheckInDate = Request("Change_CheckInDate")
Hotel_CheckOutDate = Request("Change_CheckOutDate")
If Not IsDate(Hotel_CheckInDate) Then Hotel_CheckInDate = Date()
If DateDiff("d", Date(), Hotel_CheckInDate)<1 Then Hotel_CheckInDate = Date()
If Not IsDate(Hotel_CheckOutDate) Then Hotel_CheckOutDate = DateAdd("d", 1, Hotel_CheckInDate)
If DateDiff("d", Hotel_CheckInDate, Hotel_CheckOutDate)<1 Then Hotel_CheckOutDate = DateAdd("d", 1, Hotel_CheckInDate)
Hotel_CheckInDate = FormatDate(Hotel_CheckInDate)
Hotel_CheckOutDate = FormatDate(Hotel_CheckOutDate)
Call SetCookie(EL_Sn, "Hotel_CheckInDate", Hotel_CheckInDate, 7)
Call SetCookie(EL_Sn, "Hotel_CheckOutDate", Hotel_CheckOutDate, 7)
Response.Write "1"
End Sub
Function ELClng(ByVal lng)
If IsNumeric(lng) Then
ELClng = CLng(lng)
Else
ELClng = 0
End If
End Function
Function FormatDate(ByVal fDate)
If IsDate(fDate) = False Then fDate = Date()
fDate = FormatDatetime(fDate, 2)
Dim arr
arr = Split(fDate, "-")
FormatDate = arr(0) &"-"& Right("0"& arr(1), 2) &"-"& Right("0"& arr(2), 2)
End Function
Sub SetCookie(ByVal Key, ByVal CookieName, ByVal CookieValue, ByVal CookieExpires)
Dim s, l, i, c, r
s = CookieValue
l = Len(CookieValue)
r = ""
For i = 1 To l
c = AscW(Mid(s, i, 1))
r = Join2String(r, c, "|")
Next
Response.Cookies(Key)(CookieName) = r
If CookieExpires > 0 Then
Response.Cookies(Key).Expires = DateAdd("d", CookieExpires, Now())
End If
End Sub
Function Join2String(ByVal Str1, ByVal Str2, StrDivide)
If Str1="" OR IsNULL(Str1) Then
Join2String = Str2
Else
If Str2="" OR IsNULL(Str2) Then
Join2String = Str1
Else
Join2String = Str1 & StrDivide & Str2
End If
End If
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -