Code
fkt_read_browsers_query_string () { # SENS: read and sanitize/convert query-string to useable vars
# (e.g. ?A=1&B=2 changes to correct setted vars A and B)
# ARG1: string, query string
local QUERY_STRING="$1"
test -z "$QUERY_STRING" return 1
IFS=\&
set ${QUERY_STRING%%[^%&=+-:@-_a-z~]*}
unset IFS
VARS="$(echo $* | sed -e 's/ /"; /g' -e 's/=/="/g' -e 's/$/"/g')"
VARS="$(httpd -d "$VARS")"
eval "$VARS"
}
Erklaerung
- aus dieser URL (POST/GET egal)
- NODE=512&HOST=silber2&LOCA=Steinbr&GPSX=11.3313&GPSY=50.9934&MAIL=bittorf%40bluebottle.com&PHON=0179%2F24223419&MENU=expert&GOGO=%DCbernehmen"
- wird ein
- NODE="512"; HOST="silber2"; LOCA="Steinbr"; GPSX="11.3313"; GPSY="50.9934"; MAIL="bittorf@bluebottle.com"; PHON="0179/24223419"; MENU="expert"; GOGO="Übernehmen"
- mit eval wird das ganze dann uebernommen und steht zur Verfuegung