%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /mnt/tnb2/los/backend/
Upload File :
Create Path :
Current File : //mnt/tnb2/los/backend/poradatel_nastaveni.php

<!DOCTYPE html>
<html lang="cs">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <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" />
  <title>Správa závodů LOS</title>  
  <link rel="canonical" href="https://loslex.cz/backend/" />
  <link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png" />
  <link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png" />
  <link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png" />
  <link rel="manifest" href="../site.webmanifest" />

  <!-- css -->
  <link rel="stylesheet" href="../css/bootstrap.min.css">
  <link rel="stylesheet" href="css/dashboard.css">
</head>

<body>
<?php 
ini_set( "session.gc_maxlifetime", 86400 );
session_start();
$admin=$_SESSION["admin"];
$poradatel_id=$_SESSION["poradatel_id"];
$poradatel=$_SESSION["poradatel"];
include('../sql.php');
$db=mysqli_connect(pc,user,pass,data) or die('Není spojení s databází!');
$mysqli = new mysqli(pc,user,pass,data);
?>

<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>
			  <li class="nav-item"><a class="nav-link active" href="poradatel_nastaveni.php">Nastavení pořadatele</a></li>
			  <?php if ($admin==1) {
						echo '<li class="nav-item"><a class="nav-link" href="zavodnici.php">Správa uživatelů</a></li>';
						echo '<li class="nav-item"><a class="nav-link" href="soutez_nastaveni.php">Nastavení soutěže</a></li>';
						}
						echo '</ul>';
						echo '</div>';
					if (isset($_SESSION["poradatel"])) {
						echo '<div class="navbar-nav ms-auto">';
						echo '<li class="nav-item dropdown">';
						echo '<a class="nav-link dropdown-toggle" href="login.php" role="button" data-bs-toggle="dropdown" aria-expanded="false">Pořadatel: '.$_SESSION["poradatel"].'</a>';
						echo '<ul class="dropdown-menu rounded-0">';
						echo '<li class="nav-item"><a class="nav-link dropdown-item" href="logout.php">Odhlásit</a></li>';
						echo '</ul>';
						echo '</li>';
						echo '</div>';
						}
					//else {echo '<li class="nav-item ms-auto"><a class="nav-link" href="index.php">Přihlásit</a></li>';}	
			  ?>
          </div>
        </div>
      </nav>
    </header>

  <!-- create table match *https://codepen.io/AllThingsSmitty/pen/MyqmdM* & *https://css-tricks.com/responsive-data-tables/* -->
  <div class="container">
    <div class="row">
      <div class="col-lg-12 col-md-6 mb-3 mt-lg-0 mt-3">
        <h4 class="text-center mt-3 mt-lg-0 mb-3">Nastavení předvoleb pořadatele [ID 000<?php echo $poradatel_id;?>] SK LOS SEVER z. s.</h4>

        <form class="row" method="POST">
			<?php 
				$dotaz="select * from poradatele where id_poradatele=".$poradatel_id;
				$test=mysqli_fetch_assoc($mysqli->query($dotaz));
			?>
			
			
		<div class="col-md-12 px-0 px-lg-3">
        <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">Předvolby pořadatele:</legend>
          <div class="row">

            <div class="col-md-6 mb-3">
			  <div class="form-group mb-3">
                <label for="nazev_poradatele" class="form-label small fw-semibold">Název pořadatele:</label>
                <input type="text" class="form-control form-control-sm" name="nazev_poradatele" id="nazev_poradatele" value="<?php echo $test["nazev"];?>">
              </div>
			</div>
			  
          <div class="col-md-6 mb-3">
            <div class="mb-3">
              <label for="email_poradatele" class="form-label small fw-semibold">E-mail pořadatele:</label>
              <input type="email" class="form-control form-control-sm" name="email_poradatele" id="email_poradatele" value="<?php echo $test["email"];?>">
            </div>
          </div>
			  
          <div class="col-md-6 mb-3">
            <div class="form-group mb-3">
              <label for="stranka_poradatele" class="form-label small fw-semibold">Stránka pořadatele:</label>
              <input type="text" class="form-control form-control-sm" name="stranka_poradatele" id="stranka_poradatele" value="<?php echo $test["stranka"];?>">
            </div>
          </div>

          <div class="col-md-6 mb-3">
            <div class="mb-3">
              <label for="nazev_strelnice" class="form-label small fw-semibold">Název střelnice:</label>
              <input type="text" class="form-control form-control-sm" name="nazev_strelnice" id="nazev_strelnice" value="<?php echo $test["nazev_strelnice"];?>">
            </div>
          </div>

          <div class="col-md-6 mb-3">
            <div class="mb-3">
              <label for="poloha" class="form-label small fw-semibold">Poloha střelnice:</label>
              <input type="text" class="form-control form-control-sm" name="poloha" id="poloha" value="<?php echo $test["poloha_strelnice"];?>">
            </div>
          </div>

          <div class="col-md-6 mb-3">
            <div class="mb-3">

            </div>
          </div>
		  
          </div>
          </fieldset>
        </div>

        <div class="col-12 text-center pt-1">
		  <button type="submit" name="zpet" class="btn btn-sm btn-dark">Zpět</button>
          <button type="submit" name="ulozit" class="btn btn-sm btn-success">Uložit nastavení pořadatele</button>
        </div>

        </form>
      </div>
    </div>
  </div>
<?php
if (isset($_POST['zpet'])){echo "<script>window.location.replace('main.php');</script>";}
if (isset($_POST["ulozit"])){
	$nazev_poradatele=$_POST["nazev_poradatele"];
	$poradatel_id=$_POST["poradatel_id"];
	$stranka_poradatele=$_POST["stranka_poradatele"];
	$email_poradatele=$_POST["email_poradatele"];
	$nazev_strelnice=$_POST["nazev_strelnice"];
	$stranka_strelnice=$_POST["stranka_strelnice"];
	$poloha=$_POST["poloha"];

		//test na to, jestli uz tam je nebo jenom update
	$dotaz="SELECT count(id_poradatele) AS pocet FROM poradatele where id_poradatele='".$poradatel_id."'";
	$test=mysqli_fetch_assoc($mysqli->query($dotaz));
	$pocet=$test["pocet"];
	if ($pocet>0) {
		$dotaz="UPDATE poradatele SET nazev='".$nazev_poradatele."', stranka='".$stranka_poradatele."', email='".$email_poradatele."', nazev_strelnice='".$nazev_strelnice."', stranka_strelnice='".$stranka_strelnice."', poloha_strelnice='".$poloha."'";
		}
	else {
		$dotaz="INSERT INTO poradatele (id_poradatele, nazev, stranka, email, nazev_strelnice, stranka_strelnice, poloha_strelnice, rocnik, kategorie_zavodu, uroven_zavodu, pocet_situaci, pocet_skupin, lokalni_pohar, kalibracni_zbran, startovne_plne, startovne_sleva, zpusob_registrace, prezence, zacatek, konec) VALUES ('".$poradatel_id."','".$nazev_poradatele."','".$stranka_poradatele."','".$email_poradatele."','".$nazev_strelnice."','".$stranka_strelnice."','".$poloha."')";
		}

	$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.bundle.min.js"></script>
  <script src="js/jquery.min.js"></script>
  <script src="js/main.js"></script>
</body>

</html>

Zerion Mini Shell 1.0