📄 function.asp
字号:
<%
On Error Resume Next
Err.Clear
'cookie 存活时间,一个月
CookieLife = DateAdd("m", 1,date)
Const SystemType = 1
Const RootCoID = 1 '会员管理的公司号
Const CompanySheetID = 1 '会员管理数据库中存有试用公司信息的数据表号
Const AdviceSheetID = 2 '反馈意见信息的数据表号
Const OrderSheetID = 3 '订单信息的数据表号
Const InternetUserID = 7 '会员管理数据库中匿名的"网络用户"的用户号
Const MemoSheet_ID = 201 '个人备忘录所对应的SheetID
'几个系统字段的编号
Const RowID_ID = 201
Const CreateTime_ID = 202
Const CreaterID_ID = 203
Const UpdateTime_ID = 204
Const UpdaterID_ID = 205
'公式选项
Const FormulaType_No = 1 '一般字段
Const FormulaType_Simple = 2 '简单数值计算
Const FormulaType_Condition = 3 '条件数值计算
Const FormulaType_SimpleDateDiff = 4 '简单日期间隔
Const FormulaType_ConditionDateDiff = 5 '条件日期间隔
Const FormulaType_SimpleDateAdd = 6 '简单日期计算
Const FormulaType_ConditionDateAdd = 7 '条件日期计算
Const FormulaType_SimpleText = 8 '简单文字拼接
Const FormulaType_ConditionText = 9 '条件文字拼接
Const FormulaType_ConditionOption = 10 '自动推定选项
'报表类型
Const ReportType_List = 1
Const ReportType_Analyze = 2
Const ReportType_Sum = 3
'系统内部短信组别
Const MsgGroupReceived_ID=1
Const MsgGroupSended_ID=2
Const MsgGroupDeleted_ID=3
'表单模板的类型
Const TableType_Page = 1
Const TableType_List = 2
dim ItemSep,GroupSep
ItemSep=Chr(2)
GroupSep=Chr(1)
dim JoinChar
JoinChar="A"
dim WExcelEnv
dim CoID,UserID,Admin,Logined,TokenKey,AppTitle
CoID=Request.Cookies("Login")("CoID")
UserID=Request.Cookies("Login")("UserID")
Admin=Request.Cookies("Login")("Admin")
Logined=Request.Cookies("Login")("Logined")
TokenKey=Request.Cookies("Login")("TokenKey")
AppTitle=Request.Cookies("Login")("AppTitle")
Function QuotedString(varTemp)
On Error Resume Next
If IsNull(varTemp) Then
QuotedString = "''"
Else
varTemp = Replace(varTemp, "'", "''")
QuotedString = "'" & CStr(varTemp) & "'"
End If
End Function
'从字符串中获得项目的值
Function GetItemValue(strSource,strItem)
On Error Resume Next
dim pos1,pos2
GetItemValue=""
strSource=trim(strSource)
strItem=trim(strItem)
pos1=instr(1,strSource,strItem & "=")
if pos1>0 then
pos2=instr(pos1+1,strSource,";")
if pos2>0 then
pos1=instr(pos1+1,strSource,"=")+1
GetItemValue=mid(strSource,pos1,pos2-pos1)
end if
end if
End Function
'判断ID是否存在于数组IDArray中
'返回值:-1,不存在;其它值i,存在于IDArray[i]中
'History:
'Created by 郭宝华(bob guo) 2004 1 25
Function GetIndex(ID, IDArray)
On Error Resume Next
Dim i, j
GetIndex = -1
If isArray(IDArray) Then
j = UBound(IDArray)
For i = 0 To j
If IDArray(i) = ID Then
GetIndex = i
Exit For
End If
Next
End If
End Function
'转向异常页面,该页面置于浏览器主页面。
'History:
'Created by 郭宝华(bob guo) 2004 5 31
function GoExceptPage(strPage)
On Error Resume Next
dim CurURL,WexcelPos,depth,strBody
CurURL=Request.ServerVariables("URL")
CurURL = LCase(CurURL)
Replace CurURL, "\", "/"
WexcelPos = InStr(1, CurURL, "hcgis")
If WexcelPos > 0 Then
CurURL = Mid(CurURL, WexcelPos)
depth = UBound(Split(CurURL, "/")) - 1
strBody = "<script language='JavaScript'>window"
For WexcelPos = 1 To depth
strBody = strBody & ".parent"
Next
strBody = strBody & ".location.href = '" + strPage +"'"
strBody =strBody & "</script>"
End If
Response.write strBody
Response.End
end function
sub CheckUser()
dim ErrNo,ErrDesc
dim CurURL
CurURL = Request("URL")
dim LoginFrom
LoginFrom=Request.Cookies("Temp")("LoginFrom")
if Request.QueryString <> "" then
CurURL = CurURL & "?" & Request.QueryString
end if
CurURL=Server.urlencode(CurURL)
if UserID = "" then
GoExceptPage( LoginFrom)
else
if Logined="1" then
dim ChkToken
set WExcelEnv=server.CreateObject("WExcel.UserAuth")
if WExcelEnv.CheckDBConn(ErrNo,ErrDesc) then
ChkToken=WExcelEnv.CheckToken(cint(UserID),cstr(TokenKey))
if ChkToken="1" then
GoExceptPage("/hcgis/error.asp?ErrNo=0201")
elseif ChkToken="2" then
GoExceptPage("/hcgis/error.asp")
end if
else
GoExceptPage("/hcgis/error.asp?ErrNo=" & ErrNo)
end if
else
GoExceptPage(LoginFrom)
end if
end if
end sub
function CheckErr()
if Err.number<>0 then
if Err.number=-2147467259 then
Response.Redirect "/hcgis/error.asp?ErrNo=0108"
else
Response.Redirect "/hcgis/error.asp"
end if
end if
end function
'取得客户端的IP地址
function getClientIP()
Dim strIPAddr
Dim strIPAddrFor
strIPAddrFor=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If strIPAddrFor = "" OR InStr(strIPAddrFor, "unknown") > 0 Then
'如果客户端没有通过代理服务器
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(strIPAddrFor, ",") > 0 Then
'多重代理
strIPAddr = Mid(strIPAddrFor, 1, InStr(strIPAddrFor, ",")-1)
ElseIf InStr(strIPAddrFor, ";") > 0 Then
'多重代理
strIPAddr = Mid(strIPAddrFor, 1, InStr(strIPAddrFor, ";")-1)
Else
strIPAddr = strIPAddrFor
End If
getClientIP = Trim(strIPAddr)
end function
'从ItemIDs中找到ItemID,并返回前一个ItemID。
'History:
'Created by 郭宝华(bob guo) 2007 9 13
function GetPreItemID(ItemID,ItemIDs)
On Error Resume Next
dim IDArray,iIndex
GetPreItemID=""
ItemIDs=replace(ItemIDs," ","")
if ItemIDs<>"" then
IDArray=split(ItemIDs,",")
iIndex=GetIndex(ItemID, IDArray)
if iIndex>0 then
GetPreItemID=IDArray(iIndex-1)
end if
end if
end function
'从ItemIDs中找到ItemID,并返回后一个ItemID。
'History:
'Created by 郭宝华(bob guo) 2007 9 13
function GetNextItemID(ItemID,ItemIDs)
On Error Resume Next
dim IDArray,iIndex
GetNextItemID=""
ItemIDs=replace(ItemIDs," ","")
if ItemIDs<>"" then
IDArray=split(ItemIDs,",")
iIndex=GetIndex(ItemID, IDArray)
if iIndex>=0 and iIndex<ubound(IDArray) then
GetNextItemID=IDArray(iIndex+1)
end if
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -