// check session
session_regenerate_id();
session_destroy();
session_id($_REQUEST["sid"]);
session_start();
if (!$_SESSION['mb_user_id']) {
    $notice = new mb_notice("Permission denied");
    throwE("Permission denied");
    die;
}
$n = new administration();
//if($_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']){
//	throwE(array("No session data available.","Permission denied.","Please authenticate."));
//	die();
//}
$wmsId = $n->getWmsIdFromOwsproxyString($query->getOwsproxyServiceId());
#$notice = new mb_notice("wmsid:".$wmsId);
//get authentication infos if they are available in wms table! if not $auth = false
$auth = $n->getAuthInfoOfWMS($wmsId);
#$mb_exception = new mb_exception("auth: ".$auth['username']);
if ($auth['auth_type'] == '') {
    unset($auth);
}
/*************  workflow ************/
$n = new administration();
switch (strtolower($reqParams['request'])) {
    case 'getcapabilities':
        $arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
        $query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
        $request = $query->getRequest();
        if (isset($auth)) {