$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
     $layers = checkLayerPermission($arrayOnlineresources['wms_id'], $reqParams['layers']);
     if ($layers === "") {
         throwE("Permission denied");
         die;
     }
     $query->setParam("layers", urldecode($layers));
     $request = $query->getRequest();
     if (isset($auth)) {
         getImage($url, $auth);
     } else {
         getImage($url);
     }
     break;
 case 'getlegendgraphic':
     $url = getLegendUrl($query->getOwsproxyServiceId());
     if (isset($auth)) {
         getImage($url, $auth);
     } else {
         getImage($url);
     }
     break;
 case 'external':
     getExternalRequest($query->getOwsproxyServiceId());
     break;
 case 'getfeature':
     $arrayFeatures = array($reqParams['typename']);
     $arrayOnlineresources = checkWfsPermission($query->getOwsproxyServiceId(), $arrayFeatures);
     $query->setOnlineResource($arrayOnlineresources['wfs_getfeature']);
     $request = $query->getRequest();
     $request = stripslashes($request);
        #log proxy requests
        if ($n->getWmsLogTag($wmsId) == 1) {
            #do log to db
            #TODO read out size of bbox and calculate price
            #get price out of db
            $price = intval($n->getWmsPrice($wmsId));
            $n->logWmsProxyRequest($wmsId, $userInformation[0], $request, $price);
        }
        if (isset($auth)) {
            getImage($request, $auth);
        } else {
            getImage($request);
        }
        break;
    case 'getlegendgraphic':
        $url = getLegendUrl($wmsId);
        $e = new mb_exception("URL for getlegendgraphic: ");
        if (isset($auth)) {
            getImage($url, $auth);
        } else {
            getImage($url);
        }
        break;
    default:
        echo 'Your are logged in as: <b>' . $requestHeaderArray['username'] . '</b> and requested the layer with id=<b>' . $layerId . '</b> but your request is not a valid OWS request';
}
//functions for http_auth
//**********************************************************************************************
// function to parse the http auth header
function http_digest_parse($txt)
{