Zeile 1: |
Zeile 1: |
| =Code= | | =Code= |
− | * Kompliziert:
| |
| <pre> | | <pre> |
− | fkt_read_browsers_query_string () { # SENS: read and sanitize/convert query-string to useable vars
| + | fkt_eval_query_string () { |
− | # (e.g. ?A=1&B=2 changes to correct setted vars A and B)
| + | local SANITIZED="$(echo $QUERY_STRING | sed -e 's/[^%&=+-:@-_a-z~]//g')" |
− | # ARG1: string, query string
| + | local ESCAPED="$(httpd -d $SANITIZED | sed -e 's/=/="/g' -e 's/&/";/g ' -e 's/$/"/g')" |
− | 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"
| |
− | }
| |
− | </pre>
| |
| | | |
− | * Einfach:
| + | eval $ESCAPED |
− | <pre>
| |
− | fkt_eval_query_string () {
| |
− | eval $(httpd -d "$QUERY_STRING" | sed -e 's/[^%&=+-:@-_a-z~]//g' -e 's/=/="/g' -e 's/&/"; /g ' -e 's/$/"/g')
| |
| } | | } |
| </pre> | | </pre> |