<html>
	<head>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>

		<!-- DiscoJuice hosted by UNINETT at discojuice.org -->
		<script type="text/javascript" src="https://cdn.discojuice.org/engine/discojuice-stable.min.js"></script>
		<link rel="stylesheet" type="text/css" href="https://cdn.discojuice.org/css/discojuice.css" />
		<script type="text/javascript">
			DiscoJuice.Hosted.setup({
				"target": "#login",
				"spentityid": "https://clarin.oeaw.ac.at/shibboleth",
				"redirectURL": "https://clarin.oeaw.ac.at/Shibboleth.sso/Login?target=https%3A%2F%2Fclarin.oeaw.ac.at%2Fshib_integr%2Ftemplate3%2F&entityID=",
                                "responseurl": "",
				"feeds": ["aconet"]
			});
		</script>
	</head>
	<body>
		<a href="view.php">View code</a><br/>
		<table>
			<?php
			$skip = array("PATH", "REMOTE_ADDR", "DOCUMENT_ROOT", "HTTPS", "GATEWAY_INTERFACE", "QUERY_STRING");
			$skipRegEx = "#^SSL_|^SERVER|^PHP_|^HTTP__|^SCRIPT_|^REQUEST_|^CONTEXT_|^REMOTE_|^HTTP_#"

			$logged = @$_SERVER['Shib-Session-ID'] != '' || @$_SERVER['REDIRECT_Shib-Session-ID'] != '';

			if(!$logged){
				echo('<tr><td>Please login <a href="#" id="login">here</a></td></tr>');
			}else{
				foreach($_SERVER as $k => $v){
					if(!preg_match($skipRegEx, $k) && !in_array($k, $skip)){
						printf('<tr><td>%s</td><td>%s</td></tr>', $k, $v);
					}
				}
			}
			?>
		</table>
	</body>
</html>