%PDF- %PDF-
Direktori : /mnt/tnb2/los/backend/ |
Current File : //mnt/tnb2/los/backend/upravitzavodnika.php |
<!doctype html> <html lang="cs"> <head> <title>Správa závodů LOS</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="canonical" href="https://loslex.cz/backend/"> <!-- favicons --> <link rel="apple-touch-icon" sizes="180x180" href="/theme/public/images/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="/theme/public/images/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="/theme/public/images/favicon-16x16.png"> <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/theme/public/images/logo.png"> <link rel="mask-icon" href="/theme/public/images/safari-pinned-tab.svg" color="#5bbad5"> <meta name="apple-mobile-web-app-title" content="Správa závodů LOS"> <meta name="application-name" content="Správa závodů LOS"> <meta name="msapplication-TileColor" content="#da532c"> <meta name="theme-color" content="#ffffff"> <meta name="color-scheme" content="dark light"> <!-- css --> <link rel="stylesheet" href="../css/bootstrap.min.css"> <link rel="stylesheet" href="css/dashboard.css"> </head> <body> <?php session_start(); include('../sql.php'); $mysqli = new mysqli(pc,user,pass,data); $admin=$_SESSION["admin"]; $poradatel_uid=$_SESSION["poradatel_uid"]; $poradatel=$_SESSION["poradatel"]; $id=$_GET["id"]; $dotaz="select jmeno,prijmeni,email,uzivatel,poradatel,admin from registrace where id=".$id; $udaje=mysqli_fetch_assoc($mysqli->query($dotaz)); $jmeno=$udaje["jmeno"]; $prijmeni=$udaje["prijmeni"]; $email=$udaje["email"]; $uzivatel=$udaje["uzivatel"]; $poradatel=$udaje["poradatel"]; $admin_dtb=$udaje["admin"]; ?> <header> <nav class="navbar navbar-expand-md fixed-top bg-light border-bottom"> <div class="container-fluid"> <span class="navbar-brand fw-bold fs-6">SK LOS SEVER z. s.</span> <button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#loslex"><span class="fas fa-bars"></span></button> <div class="collapse navbar-collapse" id="loslex"> <div class="navbar-nav mx-auto"> <ul class="navbar-nav mb-2 mb-lg-0"> <li class="nav-item"><a class="nav-link" href="main.php">Přehled závodů</a></li> <li class="nav-item"><a class="nav-link" href="novy.php">Nový závod</a></li> <?php if ($admin==1) {echo '<li class="nav-item"><a class="nav-link active" href="zavodnici.php">Seznam závodníků</a></li>';} if (isset($_SESSION["poradatel"])){echo '</div><div class="navbar-nav ms-auto"> <li class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="login.php" role="button" data-bs-toggle="dropdown" aria-expanded="false">Pořadatel: '.$_SESSION["poradatel"].'</a> <ul class="dropdown-menu rounded-0"> <li class="nav-item"><a class="nav-link dropdown-item" href="nastaveni.php">Nastavení</a></li> <li class="nav-item"><a class="nav-link dropdown-item" href="logout.php">Odhlásit</a></div></li> </ul> </li>';} ?> </ul> </div> </div> </nav> </header> <!-- menu tab-content --> <div class="container"> <div class="row"> <div class="col-lg-12 offset-lg-0"> <h4 class="text-center mt-3 mt-lg-0 mb-3">Změna registrace pro <?php echo $jmeno." ".$prijmeni; ?></h4> <!-- krok 1 --> <div class="row py-2"> <div class="col-md-6 mx-auto"> <form action="" method="post"> <div class="row"> <!-- Parametry --> <fieldset class="border bg-white px-3 px-lg-4 pb-3 mb-3"> <legend class="float-none w-auto px-2 fs-6 fw-bold">Nastavení registrace:</legend> <div class="row"> <div class="col-md-6"> <div class="form-group mb-3"> <label for="prijmeni" class="form-label small fw-semibold mb-1">Příjmení:</label> <input type="text" class="form-control form-control-sm" name="prijmeni" id="prijmeni" value="<?php echo $prijmeni;?>" required /> </div> </div> <div class="col-md-6 mb-3"> <div class="form-group"> <label for="jmeno" class="form-label small fw-semibold mb-1">Jméno:</label> <input type="text" class="form-control form-control-sm" name="jmeno" id="jmeno" value="<?php echo $jmeno;?>" required /> </div> </div> <div class="col-md-6 mb-3"> <div class="form-group"> <label for="email" class="form-label small fw-semibold mb-1">E-mail:</label> <input type="email" class="form-control form-control-sm" name="email" id="email" value="<?php echo $email;?>" required /> </div> </div> <div class="col-md-6 mb-3"> <div class="form-group"> <label for="uzivatel" class="form-label small fw-semibold mb-1">Uživatel:</label> <input type="text" class="form-control form-control-sm" name="uzivatel" id="uzivatel" value="<?php echo $uzivatel;?>" required /> </div> <span id='logname_mesaz'></span> </div> <div class="col-md-6"> <div class="form-check"> <input class="form-check-input" type="checkbox" id="poradatel" name="poradatel" <?php if ($poradatel==1) {echo "checked";}?> /> <label class="form-check-label" for="poradatel">Pořadatel závodů</label> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" id="admin" name="admin" <?php if ($admin_dtb==1) {echo "checked";}?> disabled /> <label class="form-check-label" for="admin">Admin</label> </div> </div> <div class="col-12 text-center pt-3"> <button type="submit" name="zpet" class="btn btn-sm btn-dark">Zpět</button> <button type="submit" name="upravit" class="btn btn-sm btn-success">Uložit změny</button> </div> </fieldset> </div> </form> </div> </div> </div> </div> </div> </div> <?php if (isset($_POST['zpet'])){echo "<script>window.location.replace('zavodnici.php');</script>";} if (isset($_POST['upravit'])) { $jmeno=$_POST["jmeno"]; $prijmeni=$_POST["prijmeni"]; $email=$_POST["email"]; $uzivatel=$_POST["uzivatel"]; if (!empty($_POST["poradatel"])) {$poradatel=1;} else {$poradatel=0;} if (!empty($_POST["admin_dtb"])) {$admin_dtb=1;} else {$admin_dtb=0;} $mysqli = new mysqli(pc,user,pass,data); $dotaz="SELECT uzivatel FROM registrace where id='".$id."'"; $test=mysqli_fetch_assoc($mysqli->query($dotaz)); if ($uzivatel==$test["uzivatel"]) { $dotaz="UPDATE registrace SET jmeno='".$jmeno."',prijmeni='".$prijmeni."',email='".$email."',uzivatel='".$uzivatel."',poradatel='".$poradatel."' WHERE id='".$id."'"; $mysqli->query($dotaz); $mysqli->close(); echo "<meta http-equiv='refresh' content='1'>"; } else { $dotaz="SELECT count(uzivatel) AS pocet FROM registrace where uzivatel='".$uzivatel."'"; $test=mysqli_fetch_assoc($mysqli->query($dotaz)); $pocet=$test["pocet"]; if ($pocet>0) {echo '<script> document.getElementById("logname_mesaz").style.color = "red"; document.getElementById("logname_mesaz").innerHTML = "Uživatelské jméno je již použito, vyberte jiné!"; document.getElementById("uzivatel").focus(); </script>';} else { $dotaz="UPDATE registrace SET jmeno='".$jmeno."',prijmeni='".$prijmeni."',email='".$email."',uzivatel='".$uzivatel."',poradatel='".$poradatel."' WHERE id='".$id."'"; $mysqli->query($dotaz); $mysqli->close(); echo "<meta http-equiv='refresh' content='1'>";} } } ?> <!-- footer --> <footer class="footer mt-auto py-3"> <div class="container"> <p class="text-center copyright">2023 | mickey & strasidlo | created for defens shooting</p> </div> </footer> <!-- scripts --> <script src="../js/bootstrap.min.js"></script> </body> </html>