1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| option explicit
dim pParams()
dim bParamExist
sub extraireParametres()
' Extrait les paramêtres de la requêtes dans le tableau pParams
dim params, url, i, decode, couple
url = split(Parent.Location, "?", -1)
if (UBound(url) = 0) then
bParamExist = false
exit sub
end if
' Décodage de l'URL
decode = replace(url(1), "+", " ")
decode = replace(decode, "%3", ":")
decode = replace(decode, ":A", ":")
decode = replace(decode, "%5", "\")
decode = replace(decode, "\C", "\")
decode = replace(decode, "%27", "''")
params = split(decode, "&", -1)
ReDim pParams(UBound(params), 1)
for i = 0 to UBound(params)
couple = split(params(i), "=", -1)
pParams(i, 0) = couple(0)
if UBound(couple) = 0 then
pParams(i, 1) = ""
else
pParams(i, 1) = couple(1)
end if
next
bParamExist = true
end sub
public function getIndice(param)
' Retourne l'indice du paramêtre param, sinon -1
if bParamExist = false then
getIndice = -1
exit function
end if
dim i, j
j = -1
for i = 0 to UBound(pParams)
if pParams(i, 0) = param then
j = i
end if
next
getIndice = j
end function
public function getValeur(param)
' retourne la valeur du paramêtre param, sinon null
dim i
i = getIndice(param)
if i <> -1 then
getValeur = pParams(i, 1)
else
getValeur = null
end if
end function |
Partager