function ' ======== get the URL with port, recommend to use ================
Function Get_scriptnameurl ()
If Request.ServerVariables ("server_port") = "Then"
Get_scriptnameurl= "http://" & Request.ServerVariables ("SERVER_NAME") &lcase ("Request.ServerVariables" Script_name "))
Else
Get_scriptnameurl= "http://" & Request.ServerVariables ("SERVER_NAME") & ":" &request.servervariables (" Server_port ") &lcase (Request.ServerVariables (" Script_name "))
End If
End Function
' ================= a function that uses regular expressions to highlight the words that are queried in the string ======================
Function Boldword (Strcontent,word)
If word= "" Then
Boldword = strcontent
Exit Function
End IF
Dim objregexp
Set objregexp=new REGEXP
Objregexp.ignorecase =true
Objregexp.global=true
Objregexp.pattern= "(& Word &)"
Strcontent=objregexp.replace (strcontent, "<font color=" "#FF0000" "><b>$1</b></font>")
Set objregexp=nothing
Boldword=strcontent
End Function
' =============== gets the user's current IP address ===================
Function GetIP ()
UIP = Request.ServerVariables ("Http_x_forwarded_for")
If UIP = "" Then UIP = Request.ServerVariables ("REMOTE_ADDR")
GetIP = UIP
End Function
' =============== Gets the current program script path ==================
Function Getscriptname ()
scriptaddress = CStr (Request.ServerVariables ("Script_name")) ' Get current address
If (Request.QueryString <> "") Then
scriptaddress = scriptaddress & "?" & Server.HTMLEncode (Request.QueryString) ' Get with parameter address
End If
If Len (scriptaddress) >250 Then scriptaddress = Left (scirptaddress,250) & "..." ' For path interception, maximum 250 characters
Getscriptname = scriptaddress
End Function
' =========== returns a URL with parameters, using ============== when sorting multiple keywords
' removelist parameter: A parameter that needs to be removed from the URL, which can be multiple, separated by commas in the middle
Function Keepurlstr (removelist)
scriptaddress = CStr (Request.ServerVariables ("Script_name")) & "?" Get the current address and add "?" Symbol
M_itemurl = ""
For each m_item in Request.QueryString
If InStr (removelist,m_item) =0 Then
M_itemurl = M_itemurl & m_item & "=" & Server.URLEncode (Request.QueryString ("" &M_Item& ")) &" & "
End If
Next
Keepurlstr = scriptaddress & M_itemurl
End Function