array( 'verify_peer' => false, "verify_peer_name"=>false ))); libxml_set_streams_context($context); $url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://127.0.0.1:$_SERVER[SERVER_PORT]/cgi-bin/authLogin.cgi?sid=".$_COOKIE['NAS_SID']; $xml = simplexml_load_file($url); unset($context); if ( (false === $xml) || !isset($xml->authPassed) || !isset($xml->username) || !isset($xml->isAdmin) ) { die('Unable to retrieve xml authentication info from your qnap device.'); } if ( !(bool)(int)$xml->authPassed[0] || !(bool)(int)$xml->isAdmin[0] || (string)$xml->username[0] !== $_COOKIE['NAS_USER']) { die('No authentic session id of an admin user!'); } } else { die('Not logged in!'); } include_once("/home/httpd/cgi-bin/qpkg/RoonServer/__include.php"); include_once("/home/httpd/cgi-bin/qpkg/RoonServer/__functions.php"); ?>