<?php
session_start();
header("Expires: Mon, 26 Jul 1997 01:00:00 GMT"); // Data passata
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // sempre modificato
header("Cache-Control: max-age=0, private, no-store, no-cache, must-revalidate"); // HTTP/1.1
//header("Cache-Control: post-check=0, pre-check=0", false); 
header("Pragma: no-cache"); // HTTP/1.0 

include("include/setsession.php");
if ($s_iduser == 0) {
	header("Location: login.php");
} else {
	require_once("include/connect.inc");
	require_once("include/functions.php");
	mysqli_query($link, "SET character_set_results=utf8");
	$sz = 0;
	$go = "";
	$sv = 0;
	$ided = 0;
	$day = '';
	if (isset($_GET['sz']) && $_GET['sz'] != '') $sz = $_GET['sz'];
	if (isset($_GET['go']) && $_GET['go'] != '') $go = $_GET['go'];
	if (isset($_GET['sv']) && $_GET['sv'] != '') $sv = $_GET['sv'];

	if (isset($_SESSION['ided'])) $ided = $_SESSION['ided'];
	if (isset($_SESSION['dataed'])) $day = $_SESSION['dataed'];

	$ided  = 1;
	$_SESSION['ided'] = 0;
	$_SESSION['dataed'] = '';

	if ($_SESSION['userlevel'] != 1 && $sz == 0) $sz = 1;
?>
	<!doctype html>
	<html lang="it">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title><?php echo htmlspecialchars($s_title, ENT_QUOTES, 'UTF-8'); ?> - Upload Manager</title>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="keywords" content="tv monitoring">
		<meta name="description" content="">
		<!-- favicon, stylesheet, script ecc. -->
		<!-- <link rel="icon" href="/path/to/favicon.ico"> -->
		<!-- <link rel="stylesheet" href="css/styles.css"> -->

		<?php include("lib.php"); ?>

		<!-- Font Awesome -->
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

		<script type="text/javascript">
			$(document).ready(function() {
				<?php if ($go == 'showEditionsType') echo 'showEditionsType();' ?>
				<?php if ($go == 'showEditions') echo 'showEditions();' ?>
				<?php if ($go == 'showSetupAlarm') echo 'showSetupAlarm(' . $sv . ');' ?>
				<?php if ($ided == 0) echo 'loadLastUpload("' . $day . '", "' . $ided . '");' ?>
			})

			function downloadProfile() {

			}

			function showSetupAlarm(saved) {
				$("#opaco").show();
				$("#loader").show();
				$.ajax({
					type: "GET",
					url: "sql_getSetupAlarm.php",
					data: 'id=1',
					success: function(data) {
						$("#maincontent").html(data);
						if (saved == 1) $("#config_saved").html('<br><b>Configurazione salvata</b>');

						$("#loader").hide();
						$("#opaco").hide();
					}
				});
			}

			function clearAudio() {
				//var audio = $("audio").get(0);
				//audio.pause(0);
				//var tmp = audio.src;
				//audio.src = "";
				//audio.load();
				$("audio").remove();

				$("#playfile").html("<audio controls preload='none' style='width:200px;'></audio>");
				//audio = $("audio").get(0);
				//audio.src = tmp;
			}

			//verificare che il file selezionato per l’upload sia un .mp3 e a gestire l’abilitazione del pulsante di submit
			function checkFile() {
				//alert('checkfile')
				var str = $("#filename").val();
				var ext = str.substr((str.length - 3), 3);
				console.log(str, ext)
				if (ext != 'mp3') {
					$('input[type="submit"]').prop('disabled', true);
					$("#filename").val("");
					alert('Selezionare un file .mp3');
				} else {
					//$('input[type="submit"]').prop('disabled', false);
					if ($('#edition').val() != 0) {
						$('input[type="submit"]').prop('disabled', false);
					}
				}
			}

			function loadLastUpload(dataed, ed) {
				//alert('loadlast')
				if (dataed != '' && ed != 0) {
					$("#opaco").show();
					$("#loader").show();

					clearAudio();

					var onclick = '';

					$('#day').val(dataed);

					var tmpday = $("#day").datepicker('getDate');
					var d = $.datepicker.formatDate('yy', tmpday) + '-' + $.datepicker.formatDate('mm', tmpday) + '-' + $.datepicker.formatDate('dd', tmpday);

					$.ajax({
						type: "GET",
						url: "sql_getFilterEditions.php",
						data: 'd=' + d,
						success: function(data) {
							$("#seleditions").html(data);

							$('#edition').val(ed);
							var id = '#' + ed;
							var filename = $(id).val();

							var filename_prop = $(id + '_prop').val();


							if ($('#edition').val() != 0) {
								if (filename_prop == 'Non esiste') {
									$("#playfile").html('<br><br>Ultimo upload <b>' + filename_prop + '</b>');
								} else {
									$("#playfile").html('<audio controls id="audio" preload="none" style="width:200px;"><source src="<?php echo $_SESSION['urlbase'] . '/' ?>' + filename + '" type="audio/mpeg">Il browser non supporta il file.</audio><br><br><?php echo $_SESSION['urlbase'] . '/' ?>' + filename + '<br><br>Ultimo upload <b>' + filename_prop + '</b>');
								}
								if ($("#filename").val() != '') checkFile();
								$('input[type="submit"]').prop('disabled', false);
							} else {
								$('input[type="submit"]').prop('disabled', true);
								alert('Seleziona edizione');
							}

							$("#loader").hide();
							$("#opaco").hide();
						}
					});
				}
			}

			function filterEditions() {
				// LA FUNZIONE VIENE CHIAMATA AL CHANGE DELLA DATA
				$("#opaco").show();
				$("#loader").show();

				clearAudio();

				var tmpday = $("#day").datepicker('getDate');
				var d = $.datepicker.formatDate('yy', tmpday) + '-' + $.datepicker.formatDate('mm', tmpday) + '-' + $.datepicker.formatDate('dd', tmpday);

				//Recupera tutte le edizioni disponibili per quel giorno
				$.ajax({
					type: "GET",
					url: "sql_getFilterEditions.php",
					data: 'd=' + d,
					success: function(data) {
						$("#seleditions").html(data);
						changeEdition();
						//$("#loader").hide();
						//$("#opaco").hide();
					}
				});

				// visualizzo lo stato degli upload del giorno
				$.ajax({
					type: "GET",
					url: "sql_getUploadCheck.php",
					data: 'd=' + d,
					success: function(data) {
						$("#uploadcheck").html(data);
						$("#loader").hide();
						$("#opaco").hide();
					}
				});
			}

			function changeEdition() {
				// Nasconde playfile inizialmente
				$("#playfile").hide();

				$('#edition').change(function() {
					var id = '#' + $('#edition').val();
					var filename = $(id).val();
					var filename_prop = $(id + '_prop').val();

					if ($('#edition').val() != 0) {
						// Mostra playfile solo se è selezionata un'edizione valida
						$("#playfile").fadeIn(1000).css("display", "table-cell");

						if (filename_prop == 'Non esiste') {
							$("#playfile").html('<br><br>Last upload <b>' + filename_prop + '</b>');
						} else {
							$("#playfile").html('<audio controls id="audio" preload="none" style="width:200px;"><source src="<?php echo $_SESSION['urlbase'] . '/' ?>' + filename + '" type="audio/mpeg">Il browser non supporta il file.</audio><br><br><?php echo $_SESSION['urlbase'] . '/' ?>' + filename + '<br><br>Last upload <b>' + filename_prop + '</b>');
						}

						if ($("#filename").val() != '') checkFile();
						$('input[type="submit"]').prop('disabled', false);
					} else {
						// Nasconde playfile se non è stata selezionata un'edizione
						$("#playfile").hide();
						$('input[type="submit"]').prop('disabled', true);
						alert('Seleziona edizione');
					}
				});
			}


			function showHide() {
				$("#opaco").show();
				$("#loader").show();
			}

			$(function() {
				$('.tree').treegrid({
					initialState: 'collapsed'
				});
				$("#sxsidemenu").accordion({
					active: <?php echo $sz ?>
				});
			});

			function closeDet() {
				//$("#maincontent").html("");
				//location.reload();
				window.open('index.php', '_self');
			}

			function showEditions() {
				$("#opaco").show();
				$("#loader").show();
				$.ajax({
					type: "GET",
					url: "sql_getEditions.php",
					success: function(data) {
						$("#maincontent").html(data);
						$("#loader").hide();
						$("#opaco").hide();
					}
				});
			}

			function editEditions(id) {
				$("#opaco").show();
				$("#loader").show();
				$.ajax({
					type: "GET",
					url: "sql_getEditions.php",
					data: 'id=' + id,
					success: function(data) {
						$("#maincontent").html(data);
						$("#loader").hide();
						$("#opaco").hide();
					}
				});
			}

			function showEditionsType() {
				$("#opaco").show();
				$("#loader").show();
				$.ajax({
					type: "GET",
					url: "sql_getEditionsType.php",
					success: function(data) {
						$("#maincontent").html(data);
						$("#loader").hide();
						$("#opaco").hide();
					}
				});
			}

			function editEditionsType(id) {
				$("#opaco").show();
				$("#loader").show();
				$.ajax({
					type: "GET",
					url: "sql_getEditionsType.php",
					data: 'id=' + id,
					success: function(data) {
						console.log(data)
						$("#maincontent").html(data);
						$("#loader").hide();
						$("#opaco").hide();
					}
				});
			}

			function deleteEditionsType(id) {
				$("#opaco").show();
				$("#loader").show();
				if (confirm("Eliminare il record?") == true) {
					$.ajax({
						type: "GET",
						url: "sql_delEditionsType.php",
						data: 'id=' + id,
						success: function(data) {
							if (data == 1) {
								$("#maincontent").html("<b>Record eliminato</b>");
								showEditionsType();
							} else if (data == 0) {
								$("#maincontent").html("<b>Server error</b>");
								$("#loader").hide();
								$("#opaco").hide();
							}
						}
					});
				} else {
					$("#loader").hide();
					$("#opaco").hide();
				}
			}

			function deleteEditions(id) {
				$("#opaco").show();
				$("#loader").show();
				if (confirm("Eliminare il record?") == true) {
					$.ajax({
						type: "GET",
						url: "sql_delEditions.php",
						data: 'id=' + id,
						success: function(data) {
							if (data == 1) {
								$("#maincontent").html("<b>Record eliminato</b>");
								showEditions();
							} else if (data == 0) {
								$("#maincontent").html("<b>Server error</b>");
								$("#loader").hide();
								$("#opaco").hide();
							}
						}
					});
				} else {
					$("#loader").hide();
					$("#opaco").hide();
				}
			}

			function showDetAnag(id) {
				$("#opaco").show();
				$("#loader").show();
				$.ajax({
					type: "GET",
					url: "sql_getDetAnag.php",
					data: 'id=' + id,
					success: function(data) {
						$("#maincontent").html(data);
						$("#loader").hide();
						$("#opaco").hide();
					}
				});
			}

			function deleteDetAnag(id) {
				$("#opaco").show();
				$("#loader").show();
				if (confirm("Eliminare il record?") == true) {
					$.ajax({
						type: "GET",
						url: "sql_delAnag.php",
						data: 'id=' + id,
						success: function(data) {
							if (data == 1) {
								$("#maincontent").html("<b>Record eliminato</b>");
								$.ajax({
									type: "GET",
									url: "sql_listAnag.php",
									data: '',
									success: function(data) {
										$("#listAccount").html(data);
										$("#loader").hide();
										$("#opaco").hide();
									}
								});
							} else if (data == 0) {
								$("#maincontent").html("<b>Server error</b>");
								$("#loader").hide();
								$("#opaco").hide();
							}
						}
					});
				} else {
					$("#loader").hide();
					$("#opaco").hide();
				}
			}


			function showLog() {
				$("#opaco").show();
				$("#loader").show();

				$divgrid = '<table align="left" cellspacing="8"><tr><td bgcolor="#515151"><div class="headerDet">ACCESS LOG</div><div id="btnClose" title="close" onclick="javascript:closeDet();"></div></td></tr><tr><td><div id="list" class="inner clearfix"><table id="listlog"><tr><td></td></tr></table><div id="gridpager"></div></div></td></tr></table>';
				$("#maincontent").html($divgrid);

				jQuery("#listlog").jqGrid({
					url: 'sql_getLog.php',
					datatype: "json",
					colNames: ["DATA", "UTENTE", "IP ADDRESS"],
					colModel: [{
							name: 'date1',
							index: 'date1'
						},
						{
							name: 'email',
							index: 'email'
						},
						{
							name: 'ip',
							index: 'ip'
						}
					],
					scroll: 1,
					rowNum: 2000,
					rowTotal: 2000,
					rowList: [10, 20, 30],
					pager: '#gridpager',
					viewrecords: true,
					loadonce: true,
					mtype: "GET",
					gridview: true,
					autowidth: true,
					height: 600,
					sortorder: "datelog",
					caption: "ACCESS LOG"
				});
				jQuery("#listlog").jqGrid('filterToolbar', {
					stringResult: true,
					searchOnEnter: false
				});
				$(".ui-jqgrid-titlebar").hide();

				$("#loader").hide();
				$("#opaco").hide();

			}

			function showLogUpload() {
				$("#opaco").show();
				$("#loader").show();

				$divgrid = '<table align="left" cellspacing="8"><tr><td bgcolor="#515151"><div class="headerDet">UPLOAD LOG</div><div id="btnClose" title="chiudi" onclick="javascript:closeDet();"></div></td></tr><tr><td><div id="list" class="inner clearfix"><table id="listlogup"><tr><td></td></tr></table><div id="gridpager"></div></div></td></tr></table>';
				$("#maincontent").html($divgrid);

				jQuery("#listlogup").jqGrid({
					url: 'sql_getLogUp.php',
					datatype: "json",
					colNames: ["DATA UPLOAD", "EDIZIONE", "ORA", "DATA EDIZIONE", "UTENTE", "FILENAME"],
					colModel: [{
							name: 'dateup',
							index: 'dateup',
							width: 55
						},
						{
							name: 'edition',
							index: 'edition',
							width: 70
						},
						{
							name: 'timeedition',
							index: 'timeedition',
							width: 20
						},
						{
							name: 'dateedition',
							index: 'dateedition',
							width: 30
						},
						{
							name: 'user',
							index: 'user',
							width: 50
						},
						{
							name: 'filename',
							index: 'filename',
							width: 130
						}
					],
					scroll: 1,
					rowNum: 2000,
					rowTotal: 2000,
					rowList: [10, 20, 30],
					pager: '#gridpager',
					viewrecords: true,
					loadonce: true,
					mtype: "GET",
					gridview: true,
					autowidth: true,
					height: 600,
					sortorder: "datelog",
					caption: "UPLOAD LOG"
				});
				jQuery("#listlogup").jqGrid('filterToolbar', {
					stringResult: true,
					searchOnEnter: false
				});
				$(".ui-jqgrid-titlebar").hide();

				$("#loader").hide();
				$("#opaco").hide();
			}

			function checkPwd(type) {
				if (type == 1) {
					if ($('#pwd').val() != "") {
						if ($('#pwd').val() != $('#pwdold').val()) {
							$('#pwdcheck').focus();
						} else {
							$('#pwdcheck').val("");
							return true
						}
					}
				} else if (type == 2) {
					if ($('#pwd').val() != "") {
						if ($('#pwd').val() != $('#pwdold').val()) {
							if ($('#pwd').val() != $('#pwdcheck').val()) {
								$('#pwd').val("");
								$('#pwdcheck').val("");
								alert('Le password non corrispondono');
							} else {
								return true
							}
						} else {
							$('#pwdcheck').val("");
							return true
						}
					}
				}
			}


			function display_dbsettings() {

				$.ajax({
					url: "webcore/get_content.php?display_dbsettings",
					success: function(data) {

						if (data == '')
							return false;

						document.getElementById('maincontent').innerHTML = data;

					}
				})

			}


			/* verifica connessione al db */
			function launchDCV() {

				var ip = document.getElementById('ipaddress_db').value;
				var user = document.getElementById('username_db').value;
				var pass = document.getElementById('password_db').value;
				var name = document.getElementById('dbname_db').value;

				// $('#dcvCheck').fadeOut(100);

				$.post("webcore/get_content.php?executeDcv", {

					'ip': ip,
					'user': user,
					'pass': pass,
					'name': name

				}).done(function(data) {

					setTimeout(function() {
						document.getElementById('dcvCheck').innerHTML = data;
						$('#dcvCheck').fadeIn(100);
						$('#verificationComplete').fadeIn(100);

					}, 300);


				});

			}



			function RUNdatabaseCheck() {

				var ip = document.getElementById('ipaddress_db').value;
				var user = document.getElementById('username_db').value;
				var pass = document.getElementById('password_db').value;
				var name = document.getElementById('dbname_db').value;

				var prefix = '';
				var sharedPath = ''
				var username = '';
				var password = '';

				if (document.getElementById('db_prefix')) prefix = document.getElementById('db_prefix').value;
				if (document.getElementById('shared_folder')) sharedPath = document.getElementById('shared_folder').value;
				if (document.getElementById('username_login')) username = document.getElementById('username_login').value;
				if (document.getElementById('password1_login')) password = document.getElementById('password1_login').value




				$("#saveConfig").fadeIn(300);
				$("#saveConfig").html('<i class="fas fa-spinner fa-spin" style="font-size:1.5em;"></i>'); // spinner



				$.post("webcore/get_content.php?RUNdatabaseCheck", {

					'ip': ip,
					'user': user,
					'pass': pass,
					'name': name,
					'prefix': prefix,
					'sharedPath': sharedPath,
					'username': username,
					'password': password,

				}).done(function(data) {


					if (data == 'installation_complete') {

						document.getElementById('saveConfig').onclick = function() {
							checkStatus()
						};
						document.getElementById('saveConfig').innerHTML = "<button style='width: 50%; height: 2vw; text-align: center; border-radius: 0.5vw; background-color: #80ff80; font-size: 0.8vw; text-transform:uppercase;'>SAVE</button>";

					}

				});

			}


			/* se la config. è stata cambiata effettuare il logout */
			function checkStatus() {

				$.post("webcore/get_content.php?checkStatus", {

				}).done(function(status) {

					if (status == 1) window.location.href = "login.php";
					else window.location.href = "index.php";

				})
			}
		</script>
	</head>

	<body style="margin:0; min-height:100vh; display:flex; flex-direction:column;">
		<header>
			<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm px-3">
				<div class="container-fluid">
					<!-- Logo -->
					<a class="navbar-brand d-flex align-items-center" href="index.php">
						<img src="img/logo.png" alt="Logo" width="90" height="25" class="me-2">
					</a>

					<!-- Sezione destra -->
					<div class="d-flex align-items-center ms-auto gap-3">

						<!-- Utente -->
						<div class="d-flex align-items-center bg-light px-3 py-1 rounded-3 text-secondary small">
							<i class="fa fa-user me-2 text-primary"></i>
							<span><?php echo $_SESSION['name'] . " (" . $_SESSION['userlevel'] . ")"; ?></span>
						</div>

						<!-- Pulsanti -->
						<div class="d-flex gap-2">
							<a href="index.php" class="btn btn-sm btn-primary">Home</a>
							<a href="logout.php" class="btn btn-sm btn-danger">Esci</a>
						</div>
					</div>
				</div>
			</nav>
		</header>


		<div id="main" style="flex:1; padding:0; background-color:#fff;">

			<div class="layout" style="display:flex; flex-direction:row; background-color: grey;">

				<div>
					<?php if ($_SESSION['userlevel'] == 1) { ?>
						<div id="sxsidemenu">
							<h3>Edizioni</h3>
							<div id="listEdizioni" style="padding-bottom:30px">
								<table class="tree">
									<tr class="treegrid-1">
										<td><a href="#" onclick="javascript:showEditions()">Edizioni</a></td>
									</tr>
									<tr class="treegrid-2">
										<td><a href="#" onclick="javascript:showEditionsType()">Tipo</a></td>
									</tr>
									<tr class="treegrid-1">
										<td><a href="index.php">Upload</a></td>
									</tr>
									<tr class="treegrid-2">
										<td><a href="#" onclick="javascript:display_dbsettings()">Setup Database</a></td>
									</tr>
								</table>
							</div>
							<h3>Utenti</h3>
							<div id="listAccount" style="padding:2px 2px 2px 2px;">
								<?php include("sql_listAnag.php"); ?>
							</div>
							<h3>Utility</h3>
							<div>
								<table class="tree">
									<!-- <tr class="treegrid-1"><td><a href="#" onclick="javascript:showUploadCheck()">Stato Upload</a></td></tr> -->
									<tr class="treegrid-1">
										<td><a href="#" onclick="javascript:showLog()">Access Log</a></td>
									</tr>
									<tr class="treegrid-2">
										<td><a href="#" onclick="javascript:showLogUpload()">Upload Log</a></td>
									</tr>
									<tr class="treegrid-3">
										<td><a href="#" onclick="javascript:showSetupAlarm(0)">Setup Allarmi</a></td>
									</tr>
									<tr class="treegrid-3">
										<td><a href="#" onclick="javascript:downloadProfile()">Esporta</a></td>
									</tr>
								</table>
							</div>
						</div>
					<?php } else { ?>
						<div id="sxsidemenu">
							<h3>Tools</h3>
							<div>
								<table class="tree">
									<!-- <tr class="treegrid-1"><td><a href="#" onclick="javascript:showUploadCheck()">Stato Upload</a></td></tr> -->
									<tr class="treegrid-2">
										<td><a href="#" onclick="javascript:showLogUpload()">Log</a></td>
									</tr>
									<tr class="treegrid-2">
										<td><a href="#" onclick="javascript:showLogUpload()">Profilo</a></td>
									</tr>
								</table>
							</div>
						</div>
					<?php } ?>
				</div>

				<div style="display: none;">
					<?php if ($_SESSION['userlevel'] == 1) {
					} ?>
					<div id="sxsidemenu">

						<h3>Edizioni</h3>
						<div id="listEdizioni" style="padding-bottom:30px">
							<table class="tree">
								<tr class="treegrid-1">
									<td><a href="#" onclick="javascript:showEditions()">Edizioni</a></td>
								</tr>
								<tr class="treegrid-2">
									<td><a href="#" onclick="javascript:showEditionsType()">Tipo</a></td>
								</tr>
								<tr class="treegrid-2">
									<td><a href="#" onclick="javascript:showLogUpload()">Log</a></td>
								</tr>


							</table>
						</div>
						<h3>Utenti</h3>
						<div id="listAccount" style="padding:2px 2px 2px 2px;">
							<?php include("sql_listAnag.php"); ?>
						</div>
						<h3>Utility</h3>
						<div>
							<table class="tree">
								<!-- <tr class="treegrid-1"><td><a href="#" onclick="javascript:showUploadCheck()">Stato Upload</a></td></tr> -->
								<tr class="treegrid-1">
									<td><a href="#" onclick="javascript:showLog()">Access Log</a></td>
								</tr>
								<tr class="treegrid-2">
									<td><a href="#" onclick="javascript:showLogUpload()">Upload Log</a></td>
								</tr>
								<tr class="treegrid-3">
									<td><a href="#" onclick="javascript:showSetupAlarm(0)">Setup Allarmi</a></td>
								</tr>
								<tr class="treegrid-3 d-none">
									<td><a href="#" onclick="javascript:downloadProfile()">Esporta</a></td>
								</tr>
							</table>
						</div>
					</div>



				</div>


				<!-- Main content a destra -->
				<div class="sidepadding" id="maincontent" style="flex:1; padding:20px; background:#fff;">

					<form name="insert" id="insert" method="POST" enctype="multipart/form-data" action="sql_insUpload.php" onsubmit="showHide()">
						<div class="card shadow-sm mb-4">
							<div class="card-header bg-dark text-white">
								<strong>UPLOAD</strong>
							</div>
							<div class="card-body">
								<form id="uploadForm" method="post" enctype="multipart/form-data">
									<div class="row g-3 align-items-center mb-3">
										<!-- Giorno -->
										<div class="col-md-4">
											<label for="day" class="form-label">Giorno <span class="text-danger">*</span></label>
											<input type="text" id="day" name="day" class="form-control" required readonly>
										</div>

										<!-- Edizione (nascosta finché serve) -->
										<div class="col-md-5" id="seleditions" style="display:none;">
											<label for="edition" class="form-label">Edizione <span class="text-danger">*</span></label>
											<select name="edition" id="edition" class="form-select" required>
												<option value="0"></option>
											</select>
											<input type="hidden" id="0" name="0" value="">
										</div>

										<!-- Player audio -->
										<div class="col-md-3 text-center" style="display:none;" id="playfile">
											<label class="form-label d-block">Anteprima</label>
											<audio controls id="audio" preload="none" class="w-100"></audio>
										</div>
									</div>

									<!-- Upload file -->
									<div class="mb-3">
										<label for="filename" class="form-label">Seleziona file audio <span class="text-danger">*</span></label>
										<input type="file" id="filename" name="filename" accept="audio/*" class="form-control" required onchange="checkFile()">
									</div>

									<!-- Footer con bottone -->
									<div class="card-footer text-start bg-light">
										<input id="salva" type="submit" value="Upload" class="btn btn-md text-uppercase rounded-pill" disabled />
									</div>
								</form>
							</div>
						</div>

					</form>
					<!-- LISTA RIEPILOGO DEGLI UPLOAD -->
					<div id="uploadcheck"></div>
				</div>

			</div>
		</div>


		<!-- Footer -->
		<footer style="background-color:#f0f0f0; padding:5px; text-align:center;">
			<div class="inner clearfix" style="width:100%;">
				<div class="clearfix">
					<div class="left" style="font-size:12px;">
						<?php include("footer.php"); ?>
					</div>
				</div>
			</div>
		</footer>



		<div id="opaco">&nbsp;</div>
		<div id="loader">&nbsp;</div>
	</body>

	</html>
<?php
}
?>