%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /mnt/tnb2/los/backend/
Upload File :
Create Path :
Current File : //mnt/tnb2/los/backend/rocniky.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/table-style.css" />
  <link rel="stylesheet" href="css/dashboard.css" />
</head>

<body>
<?php session_start();
ini_set( "session.gc_maxlifetime", 86400 );
$admin=$_SESSION["admin"];
$poradatel_id=$_SESSION["poradatel_id"];
$poradatel=$_SESSION["poradatel"];
?>

<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" 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-12 mb-3 mt-2">
        <h4 class="text-center mt-3 mt-lg-0 mb-3">Přehled ročníků</h4>
        <div class="rg-container p-0 p-md-3 p-lg-4">
          <table id="" class="rg-table">
            <thead>
              <tr>
                <th>Rok</th>
                <th>Aktivní</th>
				<th>Upravit</th>
				<th>Smazat</th>
              </tr>
            </thead>
            <tbody>
			  <?php
			  include('../sql.php');
			  $mysqli = new mysqli(pc,user,pass,data);
			  $dotaz=mysqli_query($mysqli,"SELECT id,rok,aktivni FROM rocniky_zavodu order by rok desc");
			 
			  while($radek = mysqli_fetch_row($dotaz)) {
              echo '<tr><form name="form" method="GET">';
              echo '<td><input class="form-control form-control-sm" type="number" name="rok" value="'.$radek[1].'" /></td>';
			  if ($radek[2]==1) {$ano="checked";} else {$ano="";}
              echo '<td data-title="Aktivní ročník:"><input name="aktivni" type="checkbox" '.$ano.' />';
			  echo '<input type="number" hidden name="id" value="'.$radek[0].'" /></td>';
			  echo '<td data-title="Změnit ročník:"><input class="btn btn-sm btn-success" type="submit" name="upravit" value="Změnit" />';
			  echo '<td data-title="Smazat ročník:"><a href="smaz.php?id='.$radek[0].'&kde=rocniky_zavodu" class="btn btn-sm btn-danger" onclick="return confirm(\'Opravdu smazat ročník '.$radek[1].'? \');" title="Smazat ročník"><i class="fas fa-trash"></i></a></td>';
              echo '</form></tr>';
			  }
              ?>
            </tbody>
          </table>
		  
			<div class="col text-center">
			<form method="POST">
			<button type="submit" name="pridat_rocnik" class="btn btn-sm btn-success">Přidat ročník</button>
			<button type="submit" name="zpet" class="btn btn-sm btn-dark">Zpět</button>
			</form>
			</div>
		  
        </div>
      </div>
    </div>
  </div>
<?php
if (isset($_POST['zpet'])){echo "<script>window.location.replace('soutez_nastaveni.php');</script>";}
if (isset($_GET["upravit"])){
	$db=mysqli_connect(pc,user,pass,data) or die('Není spojení s databází!');
	$id=$_GET["id"];
	$rok=$_GET["rok"];
	$aktivni=$_GET["aktivni"];
	if ($aktivni=="on") {$aktivni=1;} else {$aktivni=0;}
	$dotaz="UPDATE rocniky_zavodu SET rok=".$rok.",aktivni=".$aktivni." WHERE id=".$id;
	mysqli_query($db,$dotaz);
	echo '<script>window.location.replace("rocniky.php");</script>';
	
}
if (isset($_POST["pridat_rocnik"])){
	include('../sql.php');
	$mysqli = new mysqli(pc,user,pass,data);
	$db=mysqli_connect(pc,user,pass,data) or die('Není spojení s databází!');
	$maxrok='select max(rok)+1 AS maxrok from rocniky_zavodu';
	$test=mysqli_fetch_assoc($mysqli->query($maxrok));
	$pridat='INSERT INTO rocniky_zavodu (rok,aktivni) VALUES ('.$test["maxrok"].',false)';
	mysqli_query($db,$pridat);
	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