Files
runff/arbitro.php
2019-05-03 21:12:41 +02:00

763 lines
29 KiB
PHP

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php
require '/percorso/simplesamlphp/library/vendor/autoload.php';
require_once '/percorso/simplesamlphp/library/lib/_autoload.php';
require 'lib/r4fb.php';
//session_start();
$auth = new \SimpleSAML\Auth\Simple('nomeSP');
/*if (!$auth->isAuthenticated()) {
SimpleSAML_Session::getSessionFromRequest()->cleanup();
// Show login link.
print('<a href="/login">Login</a>');
}*/
//Auth livello 1:
$auth->requireAuth();
SimpleSAML_Session::getSessionFromRequest()->cleanup();
//print_r($auth->getAttributes());
$guid = $auth->getAttributes()['guid'][0];
//print_r(r4fb::fetchUsers($guid));
$nome = r4fb::fetchUsers($guid)[0]['nome'];
$cognome = r4fb::fetchUsers($guid)[0]['cognome'];
$matr = r4fb::fetchUsers($guid)[0]['matr'];
//Auth livello 2:
$tipo = trim(r4fb::fetchUsers($guid)[0]['tipo']);
//print $tipo;
if($tipo != 1 && $tipo != 3)
{
$auth->logout();
header("Location: index.php?error=Privilegi insufficienti.");
die("su cunnu e tzia rua bagassa");
}
?>
<?php header('Access-Control-Allow-Origin: https://api.runpolito.ml/'); ?>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel='stylesheet' href='style/arbitro.css'/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Archivo" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body id="body">
<!-- <script type="text/javascript">
//Script gestione AJAX su eventi onClick()
function startMatch(matchid)
{
$.ajax(
{
url:"https://api.runpolito.ml/torneo/ajax/v1/ajax.php",
type:"GET",
data:{start: 1, id: matchid}
success:function(result)
{
$("div#stato").html("Partita iniziata");
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
})
}
</script> -->
<div id="header">
<?php
/*
Run4Football v0.1
This file is part of Run4Football. (C)2019 Corrado Mulas - CM TLC - R&D Dept. - Ardara (SS)
Run4Football is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Run4Football is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Run4Football. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Description of arbitro
*
* @author corradomulas for Run PoliTo - Corso Duca degli Abruzzi 24, 10129 Torino (TO)
*/
// put your code here
//MAIN:
//ins. codice auth e recupera $torneo da sessione
// echo r4fb::insTorneo(0,"merda","merda","merda");
//$torneo lo prendi da guid, l'arbitro è assegnato ad uno e un solo torneo
// print("<p>Ciao, ".$nome." ".$cognome." <button value='logout' onclick='logout()'>Logout</button></p>");
$torneo = r4fb::curTourn($guid);
$nometorn = r4fb::tournData($torneo)['nome'];
echo "<span id='clock' onload='showTime()' style='margin-left:2%'></span><span style='margin-left:30%'>R: ".$matr."</span> "."<span style='float:right'>P1/1 C1&nbsp;&nbsp;&nbsp;T: ".$nometorn."</span>";
//$torneo = '0D3E9767-EDA6-447C-B925-145CDA2D75D1';
// r4fb::insMatch(10, 'merda1s1', 'merda1s2', 'bastard1', $torneo);
// r4fb::insMatch(10, 'merda2s1', 'merda2s2', 'bastard2', $torneo);
?>
</div>
<div class="maincont">
<div class="stato"></div>
<div class="points wtext">
<h2>Attendere aggiornamento prima di ripetere operazione</h2>
<span class="falli">Falli&nbsp;</span><span class="falli" id="falli1">0</span>&nbsp;&nbsp;<strong id="points"><span id="pts1">0</span>-<span id="pts2">0</span></strong>&nbsp;&nbsp;<span class="falli" id="falli2">0</span>
<span class="falli">&nbsp;Falli</span>
</div>
<!-- Sez A elenco partite (solo su tablet/PC): se su mobile, visualizza solo start partita imminente -->
<div class="match">
<ul class="partite">
<?php
/* DATI ESEMPIO:
Array
(
[0] => Array
(
[id] => 31A97136-B893-4612-8E45-5DC9957302A3
[t_prog] => 10
[t_start] =>
[t_stop] => 0
[s1] => merda1s1
[s2] => merda1s2
[pt_s1] => 0
[pt_s2] => 0
[pt] => 0
[falli] => 0
[arb] => bastard1
[torneo] => 0D3E9767-EDA6-447C-B925-145CDA2D75D1
)
[1] => Array
(
[id] => FCED463D-59A8-4D58-8D6B-BE37CCAF3593
[t_prog] => 10
[t_start] =>
[t_stop] => 0
[s1] => merda2s1
[s2] => merda2s2
[pt_s1] => 0
[pt_s2] => 0
[pt] => 0
[falli] => 0
[arb] => bastard2
[torneo] => 0D3E9767-EDA6-447C-B925-145CDA2D75D1
)
)
*
*/
//echo r4fb::curMatch($guid);
$partite = r4fb::fetchPartite($torneo,$guid);
//echo '<pre>'; print_r($partite); echo '</pre>';
$max = sizeof($partite); //limitare res a prime 5 non disputate
for($i = 0; $i < $max;$i++)
{
$marray = $partite[$i];
//servono id e ts_prog: il punteggio viene aggiornato dinamicamente via AJAX
$id = $marray['id'];
$t_prog = $marray['t_prog'];
//<strong id="points">0-0</strong>
//print pulsante di start con id, converti ts_prog in hh:mm, print campi risultato senza risultato (0 - 0)
echo '<li><span class="wtext">'.date('H:i', $t_prog).'</span><button class="startmatch btn1" value="Start" onclick="startMatch(\''.$id.'\')">start</button>'
.'<button class="stopmatch btn1" onclick="stopMatch()">Termina</button></li>';
}
?>
</ul>
<!-- fine sez A -->
<!-- Sez B su due colonne - comandi -->
<div class="giocatori">
<?php
$mid = r4fb::curMatch($guid); //setta matchid su DB su utente arbitro al momento dello start della partita
$uid = $guid; //id utente loggato, da prendere da SAML
//occorre prendere entrambe le sq dal punto precedente!
//r4fb::insSq($torneo, "cagatuppas", "#FF0000");
//r4fb::insSq($torneo, "cagatuppas2", "#FF1234");
//r4fb::insPlayer(1, 1, "Sto cazzo", "staqminchia.jpg", "");
/*r4fb::insPlayer(1, 1, "Sto cazzo", "staqminchia.jpg", "1B6582D9-4A03-437E-BB2B-B40007539963");
r4fb::insPlayer(2, 2, "Sto cazzo2", "staqminchia.jpg", "1B6582D9-4A03-437E-BB2B-B40007539963");
r4fb::insPlayer(3, 3, "Sto cazzo3", "staqminchia.jpg", "1B6582D9-4A03-437E-BB2B-B40007539963");
r4fb::insPlayer(1, 1, "Sta minchia", "staqminchia.jpg", "8BA9DD80-B8EB-4E4A-B098-DBC14D475B89");
r4fb::insPlayer(2, 2, "Sta minchia2", "staqminchia.jpg", "8BA9DD80-B8EB-4E4A-B098-DBC14D475B89");
r4fb::insPlayer(3, 3, "Sta minchia3", "staqminchia.jpg", "8BA9DD80-B8EB-4E4A-B098-DBC14D475B89");*/
//trova $squadre, hai curMatch!
$s1 = r4fb::fetchSquadre($mid)['s1'];
$s2 = r4fb::fetchSquadre($mid)['s2'];
$squadra = "8BA9DD80-B8EB-4E4A-B098-DBC14D475B89";
$players = r4fb::fetchPlayers($s1);
//echo '<pre>'; print_r($players); echo '</pre>';
$max = sizeof($players);
// echo '<strong id="points">0-0</strong>';
echo "<div class='pli' style='float:left; margin-left: 20%'><ul class='wtext' id='squadra1' >Squadra 1";
for($i = 0; $i < $max;$i++)
{
$parray = $players[$i];
$id = $parray['id'];
if($parray['isActive'])
{
//print pulsante di start con id, converti ts_prog in hh:mm, print campi risultato senza risultato (0 - 0)
echo '<li >'.'<button class="goal btn1" value="'.$id.'" onclick="insGoal(\''.$mid.'\',\''.$id.'\')">'.$parray['nome'].'</button></li>';
}
}
echo '<li><button class="fallo btn1" onclick="insFallo(\''.$s1.'\')">Fallo</button></li>'."</ul></div>";
$players = r4fb::fetchPlayers($s2);
//echo '<pre>'; print_r($players); echo '</pre>';
$max = sizeof($players);
echo "<div class='pli' style='float:right; margin-right: 20%'><ul class='wtext' id='squadra2'>Squadra 2";
for($i = 0; $i < $max;$i++)
{
$parray = $players[$i];
$id = $parray['id'];
//print pulsante di start con id, converti ts_prog in hh:mm, print campi risultato senza risultato (0 - 0)
if($parray['isActive'])
{
echo '<li >'.'<button class="goal btn1" value="'.$id.'" onclick="insGoal(\''.$mid.'\',\''.$id.'\')">'.$parray['nome'].'</button></li>';
}
}
echo '<li><button class="fallo btn1" onclick="insFallo(\''.$s2.'\')">Fallo</button></li>'."</ul></div>";
$players = r4fb::fetchPlayers($s1);
//echo '<pre>'; print_r($players); echo '</pre>';
$max = sizeof($players);
echo "<div class='ammonizione' style='float:left'><ul class='wtext' id='squadra1'>Squadra 1";
for($i = 0; $i < $max;$i++)
{
$parray = $players[$i];
$id = $parray['id'];
//print pulsante di start con id, converti ts_prog in hh:mm, print campi risultato senza risultato (0 - 0)
if($parray['isActive'])
{
echo '<li ><fieldset>'
. '<button class="ammonizione btn1" style="background-color:yellow;" value="'.$id.'" onclick="insAmm(\''.$mid.'\',\''.$id.'\',\'1\')">'.$parray['nome'].'</button>'
. '<button class="ammonizione btn1" style="background-color:red;" value="'.$id.'" onclick="insAmm(\''.$mid.'\',\''.$id.'\',\'2\')">'.$parray['nome'].'</button></fieldset></li>';
}
}
echo "</ul></div>";
$players = r4fb::fetchPlayers($s2);
//echo '<pre>'; print_r($players); echo '</pre>';
$max = sizeof($players);
echo "<div class='ammonizione' style='float:right; margin-right:20%;'><ul class='wtext' id='squadra2'>Squadra 2";
for($i = 0; $i < $max;$i++)
{
$parray = $players[$i];
$id = $parray['id'];
//print pulsante di start con id, converti ts_prog in hh:mm, print campi risultato senza risultato (0 - 0)
if($parray['isActive'])
{
echo '<li ><fieldset>'
. '<button class="ammonizione btn1" style="background-color:yellow;" value="'.$id.'" onclick="insAmm(\''.$mid.'\',\''.$id.'\',\'1\')">'.$parray['nome'].'</button>'
. '<button class="ammonizione btn1" style="background-color:red;" value="'.$id.'" onclick="insAmm(\''.$mid.'\',\''.$id.'\',\'2\')">'.$parray['nome'].'</button></fieldset></li>';
}
}
echo "</ul></div>";
?>
</div>
<!-- fine sez B -->
<!-- Sez C - comando termine -->
<ul class="termine">
<?php
echo '';
?>
</ul>
<!-- fine sez C -->
<!-- Sez D - footer -->
<ul id="footer">
<?php
?>
</ul>
<!-- fine sez D -->
<?php
?>
</div>
<div class="emgtab">Richiesta assistenza/soccorso <br />
<button class="btn1" onclick="logout()" style="width: 6vw"></button>
<button class="btn1" onclick="logout()" style="width: 6vw"></button>
<button class="btn1" onclick="logout()" style="width: 6vw"></button>
</div>
<div class="usertab">Utente<br />
<ul>
<li><button class="btn1" onclick="logout()" style="width: 6vw">Logout</button></li>
<li><button class="btn1" onclick="logout()" style="width: 6vw">Cambia password</button></li>
<li><button class="btn1" onclick="logout()" style="width: 6vw">Chiedi sostituzione</button></li>
</ul>
</div>
<div class="startab">Inizio/termine partita<br />
</div>
<div class="selpls">
<form name="selpls" method="post" action="">
<?php
echo "<div class='selpls' style=''><ul class='wtext' id='squadra1' >Squadra 1<li>";
$players = r4fb::fetchPlayers($s1);
//echo '<pre>'; print_r($players); echo '</pre>';
$max = sizeof($players);
for($i = 0; $i < $max;$i++)
{
$parray = $players[$i];
$id = $parray['id'];
//print pulsante di start con id, converti ts_prog in hh:mm, print campi risultato senza risultato (0 - 0)
echo '<label for="abpl1">'.$parray['nome'].'<input class="chkbx" type="checkbox" name="abpl1[]" value="'.$id.'"/>'.'</label>';
}
echo "</li>";
//echo '<li><button class="fallo btn1" onclick="insFallo(\''.$s1.'\')">Fallo</button></li>'."</ul>";
$players = r4fb::fetchPlayers($s2);
//echo '<pre>'; print_r($players); echo '</pre>';
$max = sizeof($players);
// echo "<div class='selpls' style=''>";
echo "<ul class='wtext' id='squadra2'>Squadra 2<li>";
for($i = 0; $i < $max;$i++)
{
$parray = $players[$i];
$id = $parray['id'];
//print pulsante di start con id, converti ts_prog in hh:mm, print campi risultato senza risultato (0 - 0)
echo '<label for="abpl1">'.$parray['nome'].'<input class="chkbx" type="checkbox" name="abpl1[]" value="'.$id.'"/>'.'</label>';
}
echo '</li><li><input type="submit" name="selpl" value="Seleziona giocatori"></li>'."</ul></div>";
if(isset($_POST['selpl']))
{
r4fb::togglePls($_POST['abpl1'],$s1,$s2);
print_r(count($_POST['abpl1'])); echo "<br />";
//print_r($_POST['abpl2']);
}
?>
</form>
</div>
<div class="msgtab">
<a href="#" onclick="">Tutti</a> <a href="#" onclick="">Non letti</a> <a href="#" onclick="">Letti</a>
<div id="rcvdmsgs"></div>
</div>
</div> <!-- fine main container div -->
<div id="footer">
<a href="#" onclick="emgTab()"><i class="func fas fa-life-ring"></i></a>
<a href="#" onclick="toggleBg('body')"><i class="func fas fa-moon"></i></a>
<a href="#" onclick="starTab()"><i class="func fas fa-play"></i></a>
<a href="#" onclick="matchTab()"><i class="func fas fa-futbol"></i></a>
<a href="#" onclick="ammTab()"><i class="func fas fa-thumbs-down"></i></a>
<a href="#" onclick="userTab()"><i class="func fas fa-user"></i></a>
<a href="#" onclick="msgTab()"><i class="func fas fa-envelope"></i></a>
<a href="#" onclick="selplsTab()"><i class="func fas fa-running"></i></a>
</div>
<script type="text/javascript">
window.setInterval(function(){
/// call your function here
updPoints();
}, 2000);
function getMsgs(uid, tipo)
{
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "rcmsg", uid: uid, tipo: tipo},
success:function(result)
{
$("div#rcvdmsgs").html(result);
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
});
window.location.href = 'logout.php';
}
//Script gestione AJAX su eventi onClick()
//eccetto per start, matchid si recupera da DB
function startMatch(matchid)
{
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "start", mid: matchid},
//data:{op: "start"},
success:function(result)
{
$("div#stato").html("Partita iniziata");
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
});
//jQuery(".startmatch").css('display','none');
//jQuery(".stopmatch").css('display','inline-block');
document.location.reload();
document.location.reload();
}
function stopMatch()
{
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "stop"},
success:function(result)
{
$("div#stato").html("Partita terminata");
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
});
document.location.reload();
document.location.reload();
}
function insFallo(sid)
{
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "insfa", sid: sid},
success:function(data)
{
if(data == "0")
{
$("div#stato").html("Fallo inserito"+data);
}
else if(data == "1")
{
$("div#stato").html("Quinto fallo cons.: Tiro libero previsto"+data);
}
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
});
}
function insAmm(matchid, plid, ta)
{
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "insamm", mid: matchid, plid: plid, ta: ta},
success:function(result)
{
$("div#stato").html("Partita terminata");
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
});
}
function insGoal(matchid, plid)
{
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "insgl", mid: matchid, plid: plid},
success:function(result)
{
$("div#stato").html("Partita terminata");
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
});
}
function logout()
{
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "logout"},
success:function(result)
{
$("div#stato").html("Partita terminata");
},
error:function(stato,errori)
{
$("div#stato").html("Errore"+stato+" "+errori);
}
});
window.location.href = 'logout.php';
}
function updPoints() {
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "updpt", mid:"<?php echo $mid?>", sn: "1"},
success:function(result)
{
jQuery("#pts1").text(result);
},
});
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "updpt", mid:"<?php echo $mid?>", sn: "2"},
success:function(result)
{
jQuery("#pts2").text(result);
},
});
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "updfl", sid:"<?php echo $s1?>"},
success:function(result)
{
jQuery("#falli1").text(result);
},
});
$.ajax(
{
url:"ajax/v1/ajax.php",
type:"GET",
data:{op: "updfl", sid:"<?php echo $s2?>"},
success:function(result)
{
jQuery("#falli2").text(result);
},
});
}
</script>
<!--JS grafici-->
<script language="JavaScript">
function toggleBg(id) {
var state = document.getElementById(id).style.backgroundColor;
if (state == 'black') {
$(id).css("background-color","whitesmoke");
jQuery(".wtext").css('color','black');
jQuery("#header").css('border-bottom-color','black');
} else {
$(id).css("background-color","black");
jQuery(".wtext").css('color','white');
jQuery("#header").css('border-bottom-color','white');
}
}
function emgTab()
{
jQuery(".match").css('display','none');
jQuery(".emgtab").css('display','block');
jQuery(".usertab").css('display','none');
jQuery(".msgtab").css('display','none');
jQuery(".selpls").css('display','none');
}
function userTab()
{
jQuery(".match").css('display','none');
jQuery(".usertab").css('display','block');
jQuery(".emgtab").css('display','none');;
jQuery(".selpls").css('display','none');
}
function msgTab()
{
jQuery(".match").css('display','none');
jQuery(".usertab").css('display','none');
jQuery(".emgtab").css('display','none');;
jQuery(".selpls").css('display','none');
jQuery(".msgtab").css('display','block');
jQuery("#points").css('display','none');
jQuery(".fallo").css('display','none');
jQuery(".usertab").css('display','none');
jQuery(".emgtab").css('display','none');
jQuery(".fallo").css('display','none');
jQuery(".goal").css('display','none');
jQuery(".pli").css('display','none');
jQuery(".ammonizione").css('display','none');
jQuery(".startmatch").css('display','none');
jQuery(".stopmatch").css('display','none');
jQuery(".points").css('display','none');
jQuery("#partite").css('display','none');
jQuery(".partite").css('display','none');
jQuery(".selpls").css('display','none');
}
function matchTab()
{
jQuery(".match").css('display','block');
jQuery(".usertab").css('display','none');
jQuery(".emgtab").css('display','none');
jQuery(".msgtab").css('display','none');
jQuery(".fallo").css('display','block');
jQuery(".goal").css('display','block');
jQuery(".pli").css('display','block');
jQuery(".ammonizione").css('display','none');
jQuery(".startmatch").css('display','none');
jQuery(".stopmatch").css('display','none');
jQuery("#points").css('display','inline-block');
jQuery("#partite").css('display','none');
jQuery(".partite").css('display','none');
jQuery(".selpls").css('display','none');
}
function ammTab()
{
jQuery(".match").css('display','block');
jQuery(".usertab").css('display','none');
jQuery(".emgtab").css('display','none');
jQuery(".ammonizione").css('display','block');
jQuery(".fallo").css('display','none');
jQuery(".goal").css('display','none');
jQuery(".pli").css('display','none');
jQuery(".partite").css('display','none');
jQuery("#points").css('display','none');
jQuery(".msgtab").css('display','none');
jQuery(".selpls").css('display','none');
//#fallo #ammonizione #goal #pli #partite
}
function starTab()
{
jQuery("#match").css('display','block');
jQuery(".startmatch").css('display','inline-block');
jQuery(".stopmatch").css('display','inline-block');
jQuery(".usertab").css('display','none');
jQuery(".emgtab").css('display','none');
jQuery(".ammonizione").css('display','none');
jQuery(".fallo").css('display','none');
jQuery(".goal").css('display','none');
jQuery(".pli").css('display','none');
jQuery("#partite").css('display','inline-block');
jQuery(".partite").css('display','inline-block');
jQuery("#points").css('display','none');
jQuery(".msgtab").css('display','none');
jQuery(".selpls").css('display','none');
//#fallo #ammonizione #goal #pli #partite
}
function selplsTab()
{
jQuery(".selpls").css('display','inline-block');
jQuery("#match").css('display','none');
jQuery(".startmatch").css('display','none');
jQuery(".stopmatch").css('display','none');
jQuery(".usertab").css('display','none');
jQuery(".emgtab").css('display','none');
jQuery(".ammonizione").css('display','none');
jQuery(".fallo").css('display','none');
jQuery(".goal").css('display','none');
jQuery(".pli").css('display','none');
jQuery("#partite").css('display','none');
jQuery(".partite").css('display','none');
jQuery("#points").css('display','none');
jQuery(".msgtab").css('display','none');
//#fallo #ammonizione #goal #pli #partite
}
</script>
<script type="text/javascript">
function showTime(){
var date = new Date();
var h = date.getHours(); // 0 - 23
var m = date.getMinutes(); // 0 - 59
var s = date.getSeconds(); // 0 - 59
//var session = "PM";
var session = "";
/* if(h == 0){
h = 12;
}
if(h > 12){
h = h - 12;
session = "AM";
} */
h = (h < 10) ? "0" + h : h;
m = (m < 10) ? "0" + m : m;
s = (s < 10) ? "0" + s : s;
var time = h + ":" + m + ":" + s + " " + session;
document.getElementById("clock").innerText = time;
document.getElementById("clock").textContent = time;
setTimeout(showTime, 1000);
}
showTime();
</script>
</body>
</html>