Files
Streaming/templates/login.html
2023-01-29 20:59:36 +01:00

119 lines
4.3 KiB
HTML
Executable File

<!DOCTYPE html>
<html data-theme="dark">
<head>
<title>Prihlásenie</title>
<link rel="stylesheet" href="assets/pico.css">
<meta charset="utf-8">
</meta>
<script src="assets/jquery.js"></script>
<style>
#error{
display: none;
color: #CC0000;
position: absolute;
top: 0;
right: 50%;
}
</style>
<script>
$(function() {
$("#kod").focus();
var kod = "";
var inic = "";
var listeners = "";
$("#next").click(function() {
$("#error").hide();
kod = $("#kod").val();
$.post("index.php?verify=1",
{
kod: kod
},
function(data, status){
if (data == "verified"){
$("#firstQuestion").fadeOut("slow", function(){
$("#secondQuestion").fadeIn("slow", function(){
$("#ini").focus();
});
});
}
else if(data == "admin"){
$.post("index.php",
{
kod: kod,
listeners: 1,
ini: "admin"
},
function(data, status){
location.reload();
});
}
else{
$("#error").fadeIn();
}
});
});
$("#back").click(function() {
$("#secondQuestion").fadeOut("slow", function(){
$("#firstQuestion").fadeIn("slow", function(){
$("#kod").focus();
});
});
});
$("#send").click(function() {
inic = $("#ini").val();
listeners = $("#listeners").val();
$.post("index.php",
{
kod: kod,
listeners: listeners,
ini: inic
},
function(data, status){
location.reload();
});
});
$("#kod").keyup(function(event) {
if (event.keyCode === 13) {
$("#next").click();
}
});
$("#ini").keyup(function(event) {
if (event.keyCode === 13) {
$("#listeners").focus();
}
});
$("#listeners").keyup(function(event) {
if (event.keyCode === 13) {
$("#send").click();
}
});
});
</script>
</head>
<body>
<form method="post">
<div id="firstQuestion">
<p id="error">Zlý kód</p>
<label id="kodik" for="kod">Kód:<br></label>
<input type="text" id="kod" placeholder="Kód" name="kod" required>
<br>
<button id="next" type="button">Ďalej</button>
<br>
<p>© BRN Systems __VLOZ_ROK__</p>
</div>
<div id="secondQuestion" style="display: none;">
<label for="ini">Iniciály:<br></label>
<input type="text" id="ini" placeholder="Iniciály" name="ini" required autofocus>
<br>
<label for="listeners">Počet počúvajúcich:<br></label>
<input type="text" id="listeners" placeholder="Počet počúvajúcich" name="listeners" required>
<br>
<button id="send" type="button">Prihlásiť sa</button><button id="back" type="button">Späť</button>
<br>
<p>© BRN Systems __VLOZ_ROK__</p>
</div>
</form>
</body>
</html>