Last active
February 1, 2021 22:25
-
-
Save igneus/1d102f906b81241410196de836f2a737 to your computer and use it in GitHub Desktop.
hledání jednorožce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$hesla = array( | |
"heslo" => "Tajný text", | |
"jineheslo" => "Jiný tajný text\nse zalomeními\n\nřádků", | |
// "zakomentovaneheslo" => "Pokud řádek neodkomentuješ smazáním dvou lomítek na jeho začátku , tohle heslo je neaktivní.", | |
); | |
$title = 'Hledání jednorožce'; | |
$status = null; | |
$tajemstvi = null; | |
if (isset($_POST['heslo'])) { | |
$heslo = $_POST['heslo']; | |
if (isset($hesla[$heslo])) { | |
$tajemstvi = nl2br($hesla[$heslo]); | |
} else { | |
$status = 'Zadané heslo není platné.'; | |
} | |
} | |
require 'tpl.inc.php'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title><?php echo $title; ?></title> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | |
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous"> | |
</head> | |
<body> | |
<div class="container"> | |
<h1 class="text-center my-4"><?php echo $title; ?></h1> | |
<?php | |
if ($status) { | |
echo "<div class=\"alert alert-danger\">$status</div>"; | |
} | |
if ($tajemstvi) { | |
echo "<div class=\"alert alert-success\">Heslo '$heslo' ti odemklo tajemství:</div>"; | |
echo "<p>$tajemstvi</p><hr>"; | |
} | |
?> | |
<form method="post" action="/"> | |
<div class="row my-5"> | |
<div class="col-md-10 my-2"> | |
<input type="text" name="heslo" placeholder="heslo" class="form-control"> | |
</div> | |
<div class="col-md-2 my-2"> | |
<button type="submit" class="btn btn-primary">Odeslat</button> | |
</div> | |
</div> | |
</form> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment