|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <%
- Function GetUrl()
- Dim ScriptAddress, M_ItemUrl, M_item
- ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) '取得当前地址
- M_ItemUrl = ""
- If (Request.QueryString <> "") Then
- ScriptAddress = ScriptAddress & "?"
- For Each M_item In Request.QueryString
- If InStr(page,M_Item)=0 Then
- M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(Request.QueryString(""&M_Item&"")) & "&"
- End If
- Next
- end if
- c_geturl = trim(ScriptAddress & M_ItemUrl)
- GetUrl = c_geturl
- End Function
-
- Sub makeFile(cfilename,cfilecontent)
- on error resume next
-
- filepath=Server.MapPath(cfilename)
- Set fso = Server.CreateObject("Scripting.FileSystemObject")
-
- c_fileoldcontent = ""
- Set txt = fso.OpenTextFile(filepath,1,true)
- c_fileoldcontent = txt.ReadAll
- txt.close
-
- set file = fso.opentextfile(filepath, 2 , TRUE)
- c_filenewcontent = cstr(now()) & "@" & GetIP & " : " & cfilecontent
- c_fileoldcontent = c_fileoldcontent & c_filenewcontent
- file.writeline c_fileoldcontent
- file.close
- set file = nothing
-
- set fso = nothing
- End Sub
-
- Function GetIP()
- dim strIPAddr
- If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
- strIPAddr = Request.ServerVariables("REMOTE_ADDR")
- ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
- strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
- ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
- strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
- Else
- strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
- End If
- GetIP = Trim(Mid(strIPAddr, 1, 30))
- End Function
-
- function deal_str_beforesql(csource)
- csource = trim(csource)
- csource = replace(csource,"'","")
- deal_str_beforesql = csource
- end function
-
- function deal_num_beforesql(csource)
- if len(csource)=0 then csource="0"
- if isnumeric(csoure)=false then csource="0"
- deal_num_beforesql = csource
- end function
-
- function deal_str_beforeshow(csource)
- csource = replace(csource,"&","&")
- csource = replace(csource,"<","<")
- csource = replace(csource,">",">")
- deal_str_beforeshow = csource
- end function
-
- Function URLDecode(enStr)
- dim deStr,strSpecial
- dim c,i,v
- deStr=""
- strSpecial="!""#$%&'()*+,.-_/:;< =>?@[/]^`{|}~%"
- for i=1 to len(enStr)
- c=Mid(enStr,i,1)
- if c="%" then
- v=eval("&h"+Mid(enStr,i+1,2))
- if inStr(strSpecial,chr(v))>0 then
- deStr=deStr&chr(v)
- i=i+2
- else
- v=eval("&h"+ Mid(enStr,i+1,2) + Mid(enStr,i+4,2))
- deStr=deStr & chr(v)
- i=i+5
- end if
- else
- if c="+" then
- deStr=deStr&" "
- else
- deStr=deStr&c
- end if
- end if
- next
- URLDecode=deStr
- End function
- %>
|