ชุดฟังก์ชัน ASP
'========== รับ URL ด้วยพอร์ตขอแนะนำให้ใช้ ==========================
functionget_scriptnameurl ()
ifrequest.serverVariables ("server_port") = "80" แล้ว
get_scriptNameUrl = "http: //" & request.serverVariables ("server_name") & lcase (request.serverVariables ("script_name")))
อื่น
get_scriptnameurl = "http: //" & request.serverVariables ("server_name") & ":" & request.serverVariables ("server_port") & lcase (request.serverVariables ("script_name"))
endif
endfunction
'====================== ฟังก์ชั่นเพื่อเน้นคำที่พบในสตริงที่มีนิพจน์ปกติ =========================================================================
functionboldword (strcontent, word)
ifword = "" แล้ว
boldword = strcontent
exitfunction
endif
dimobjregexp
setobjregexp = newregexp
objregexp.ignorecase = true
objregexp.global = true
objregexp.pattern = "(" & word & ")"
strContent = objregexp.replace (strcontent, "<fontColor =" "#ff0000" "> <b> $ 1 </b> </font>"
setObjregexp = ไม่มีอะไร
boldword = strcontent
endfunction
'======================== รับที่อยู่ IP ปัจจุบันของผู้ใช้ ======================
functiongetip ()
uip = request.serverVariables ("http_x_forwarded_for")
ifuip = "" thenUip = request.serverVariables ("remote_addr")
getIP = UIP
endfunction
'===================== รับเส้นทางสคริปต์โปรแกรมปัจจุบัน ========================
functiongetScriptName ()
scriptAddress = cstr (request.serverVariables ("script_name")) 'รับที่อยู่ปัจจุบัน
if (request.querystring <> "") จากนั้น
scriptAddress = scriptAddress & "?" & server.htmlencode (request.querystring) 'รับที่อยู่ด้วยพารามิเตอร์
endif
iflen (scriptAddress)> 250thenscriptaddress = ซ้าย (sciptaddress, 250) & "... " 'สำหรับการสกัดกั้นเส้นทางที่มีสูงสุด 250 อักขระ
getScriptName = scriptAddress
endfunction
'================ url return url พร้อมพารามิเตอร์ที่ใช้เมื่อเรียงลำดับคำหลักหลายคำ =======================
'พารามิเตอร์ Removelist: พารามิเตอร์ที่ต้องลบออกจาก URL สามารถเป็นได้หลายอย่างโปรดแยกพวกเขาออกด้วยเครื่องหมายจุลภาคตรงกลาง
FunctionKeepUrlstr (Removelist)
scriptAddress = cstr (request.serverVariables ("script_name")) & "?" 'รับที่อยู่ปัจจุบันและเพิ่ม "?" เครื่องหมาย
m_itemurl = ""
foreachm_iteminrequest.querystring
ifinstr (removeList, m_item) = 0 แล้ว
m_itemurl = m_itemurl & m_item & "=" & server.urlencode (request.querystring ("" & m_item & "") & "&"