<?php

require('include/glob.php');
require('include/muoribene.php');
require('include/sessionstart.php');
require('include/menu.php');
buildmenu($menu);

require('include/myconn.php');
$res=mysqli_query($link,'SELECT * FROM Instances ORDER BY URI ASC')
	or muoribene(mysqli_error($link).'<br>'.$btl,false);
mysqli_close($link);
if (mysqli_num_rows($res)<1) {
	$out='<p>Nessuna istanza da mostrare.</p>'.N;
} else {
	$out='<table>'.N;
	while ($row=mysqli_fetch_assoc($res)) {
		$out.='<tr><td>'.$row['URI'].'</td></tr>'.N;
	}
	$out.='</table>'.N;
}


?>
<!DOCTYPE HTML>
<html lang="it">
<head>
<title>Mastodon Startpage Admin - Main Menu</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="Admin pages for Mastodon Startpage">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="icon" type="image/png" href="imgs/icona-32.png" sizes="32x32">
<link rel="icon" type="image/png" href="imgs/icona-192.png" sizes="192x192">
<link rel="icon" type="image/png" href="imgs/icona-512.png" sizes="512x512">
<link rel="apple-touch-icon-precomposed" href="imgs/icona-180.png">
<link rel="stylesheet" type="text/css" href="theme.css?v=<?php echo($cjrand); ?>">
<script language="JavaScript">
<!--
function chulsh(el,sh) {
	if (sh)
		el.querySelector('ul').style='display:block';
	else
		el.querySelector('ul').style='display:none';
}
function ulsh(el,sh) {
	if (sh)
		el.style='display:block';
	else
		el.style='display:none';
}
function golang(lang) {
	var loc=document.location.href;
	loc=loc.replace(/#.*$/,'');
	loc=loc.replace(/\/$/,'');
	if (document.documentElement.lang=='en') {
		if (lang!='en')
			document.location.href=loc+'/'+lang;
	} else {
		if (lang!='en')
			document.location.href=loc.substr(0,loc.length-3)+'/'+lang;
		else
			document.location.href=loc.substr(0,loc.length-3);
	}
}
//-->
</script>
</head>
<body>

<nav>
<div id="hmenu">
<ul>
<?php echo($menuout); ?>
</ul>
</div>
</nav>

<div id="fullscreenm">
<div id="middlerow">
<?php echo($out); ?>
</div>
</div>

<div id="footer">
<form action="edinst.php" name="addinst" method="post">
<table><tr><td>Aggiungi un’istanza:</td><td><input type="text" name="URI" maxlength="512"></td><td><input type="button" value="Vai" onClick="ckaif();"></td></tr></table>
</form>
</div>
</body>
</html>
