Brug af AI afslører de svagheder, virksomheder allerede har opbygget gennem års cloud-transformation, nye SaaS-løsninger og fragmenterede sikkerhedssystemer.
Er det ikke URLEncode() eller URLDecode() du mener?
Public Function URLDecode(ByVal strUrl As String) As String Dim ci As Integer Dim strOut As String Dim strOne As String While Not (ci >= Len(strUrl)) ci = ci + 1 strOne = Mid$(strUrl, ci, 1) Select Case strOne Case "+" strOut = strOut & " " Case "%" ci = ci + 1 strOut = strOut & _ Chr$(CLng("&H" & Mid$(strUrl, ci, 2))) ci = ci + 1 Case Else strOut = strOut & strOne End Select Wend URLDecode = strOut End Function
Public Function URLEncode(ByVal bstrIn As String) As String Dim i As Long Dim lngHex As Long Dim strHex As String Dim strOne As String For i = Len(bstrIn) To 1 Step -1 strOne = Mid$(bstrIn, i, 1) Select Case Asc(UCase$(strOne)) Case vbKey0 To vbKey9, vbKeyA To vbKeyZ Case 32 Mid$(bstrIn, i, 1) = "+" Case Else lngHex = Asc(strOne) If lngHex And &HF0& Then strHex = ("%" & Hex$(lngHex)) Else strHex = ("%0" & Hex$(lngHex)) End If bstrIn = Left$(bstrIn, i - 1) & strHex & _ Mid$(bstrIn, i + 1) End Select Next i URLEncode = bstrIn End Function
Public Function HTMLEncode(ByVal bstrIn As String) As String Dim i As Long Dim Ascii As Long i = InStr(bstrIn, "&") If i Then bstrIn = Replace(bstrIn, "&", "&", i) i = InStr(bstrIn, """") If i Then bstrIn = Replace(bstrIn, """", """, i) i = InStr(bstrIn, "<") If i Then bstrIn = Replace(bstrIn, "<", "<", i) i = InStr(bstrIn, ">") If i Then bstrIn = Replace(bstrIn, ">", ">", i) For i = Len(bstrIn) To 1 Step -1 Ascii = Asc(Mid$(bstrIn, i, 1)) If Ascii >= 160 Then bstrIn = Left$(bstrIn, i - 1) & "&#" & CStr(Ascii) & ";" & Mid$(bstrIn, i + 1) End If Next i HTMLEncode = bstrIn End Function
i = 1 While i <= Len(aStr) If InStr(validChars, Mid$(aStr, i, 1)) = 0 Then If Asc(Mid$(aStr, i, 1)) < 32 Then aStr = Mid$(aStr, 1, i - 1) + Mid$(aStr, i + 1, Len(aStr) - i) Else aStr = Mid$(aStr, 1, i - 1) + "%" + Hex$(Asc(Mid$(aStr, i, 1))) + Mid$(aStr, i + 1, Len(aStr) - i) i = i + 3 End If Else i = i + 1 End If Wend
escapeString = aStr End Function
Function replaceSubstring(source As String, fromStr As String, toStr As String) As String Dim i As Integer Dim temp As String
temp = source If fromStr <> "" Then If fromStr <> toStr Then i = InStr(temp, fromStr) While i <> 0 If toStr <> "" Then temp = Left$(temp, i - 1) + toStr + Right$(temp, Len(temp) - i - Len(fromStr) + 1) Else temp = Left$(temp, i - 1) + Right$(temp, Len(temp) - i - Len(fromStr) + 1) End If
i = InStr(i + Len(toStr), temp, fromStr) Wend End If End If replaceSubstring = temp End Function
Men da jeg har formuleret mig temmelige ringe ;o) så får du dine point alligevel.
i = 1 While i <= Len(aStr) If InStr(validChars, Mid$(aStr, i, 1)) = 0 Then If Asc(Mid$(aStr, i, 1)) < 32 Then aStr = Mid$(aStr, 1, i - 1) + Mid$(aStr, i + 1, Len(aStr) - i) Else aStr = Mid$(aStr, 1, i - 1) + "%" + Hex$(Asc(Mid$(aStr, i, 1))) + Mid$(aStr, i + 1, Len(aStr) - i) i = i + 3 End If Else i = i + 1 End If Wend
escapeString = aStr End Function
Function replaceSubstring(source As String, fromStr As String, toStr As String) As String Dim i As Integer Dim temp As String
temp = source If fromStr <> "" Then If fromStr <> toStr Then i = InStr(temp, fromStr) While i <> 0 If toStr <> "" Then temp = Left$(temp, i - 1) + toStr + Right$(temp, Len(temp) - i - Len(fromStr) + 1) Else temp = Left$(temp, i - 1) + Right$(temp, Len(temp) - i - Len(fromStr) + 1) End If
i = InStr(i + Len(toStr), temp, fromStr) Wend End If End If replaceSubstring = temp End Function %>
øhh havd mener du så med at decode?? er det så man ikke kan læse det eller hvad??
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.