Lekcja 9
This commit is contained in:
@@ -59,7 +59,7 @@ class Barka extends HTMLElement {
|
||||
console.log("lekko po czasie");
|
||||
barka.start();
|
||||
} else if (sekundyDo2137 < 0) {
|
||||
alert("zaimplementować");
|
||||
console.log("zaimplementować");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,4 +200,4 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
barka.kontroler();
|
||||
});
|
||||
|
||||
window.barka = barka;
|
||||
window.barka = barka;
|
||||
|
||||
@@ -3,6 +3,7 @@ const nawigacjaLinki = [
|
||||
{ nazwa: "Grafika", link: "/grafika.html" },
|
||||
{ nazwa: "JS. Zad. Warunkowe", link: "/js-warunkowe.html" },
|
||||
{ nazwa: "JS. Pętle", link: "/js-petle.html" },
|
||||
{ nazwa: "Witalnia", link: "/witalnia.php" },
|
||||
];
|
||||
const stopkaLinki = [
|
||||
[
|
||||
@@ -25,6 +26,10 @@ const stopkaLinki = [
|
||||
{ nazwa: "Tabele", link: "/tabele.html" },
|
||||
{ nazwa: "Grafika", link: "/grafika.html" },
|
||||
],
|
||||
[
|
||||
"PHP",
|
||||
{ nazwa: "Witalnia", link: "/witalnia.php" },
|
||||
],
|
||||
[
|
||||
"Wszystko",
|
||||
{ nazwa: "Liczby", link: "/liczby.html" },
|
||||
@@ -110,4 +115,4 @@ class Footer extends HTMLElement {
|
||||
`;
|
||||
}
|
||||
};
|
||||
customElements.define("footer-comp", Footer);
|
||||
customElements.define("footer-comp", Footer);
|
||||
|
||||
65
witalnia.php
Normal file
65
witalnia.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Witalnia - MaszToZadanieDomowe.com</title>
|
||||
<link href="/favicon.ico" rel="favicon">
|
||||
<link href="/assets/css/main.css" rel="stylesheet">
|
||||
<script data-goatcounter="https://zeszyt.nonamesoft.xyz/count" async src="/assets/js/count.js"></script>
|
||||
<script type="module" src="/assets/js/index.js"></script>
|
||||
<script src="/assets/js/js-wspolne.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header-comp></header-comp>
|
||||
<main>
|
||||
<?php
|
||||
include "/config/php/templaty.php";
|
||||
|
||||
function renderuj($nazwa) {
|
||||
echo("<h2>Witaj, $nazwa</h2><hr>");
|
||||
zawartosc($nazwa);
|
||||
$odwiedziny = isset($_COOKIE["wizyty"]) ? $_COOKIE["wizyty"] : 0;
|
||||
$odwiedziny++;
|
||||
setcookie("wizyty", $odwiedziny);
|
||||
echo("
|
||||
Stronę odwiedziłeś/aś/iście $odwiedziny razy
|
||||
<form method=\"post\" action=\"/witalnia.php\">
|
||||
<input type=\"submit\" name=\"zapomnij\" value=\"Usuń mnie z listy lotów (podpowiedź)\">
|
||||
</form>
|
||||
");
|
||||
}
|
||||
|
||||
if (isset($_POST["zapomnij"])) {
|
||||
echo("
|
||||
Zapomniano
|
||||
<h2>Witaj!</h2><hr>
|
||||
<form method=\"post\" action=\"/witalnia.php\">
|
||||
<input type=\"text\" name=\"nazwa\" required=\"\" placeholder=\"Wpisz swoją nazwę\">
|
||||
<input type=\"submit\" value=\"Zapisz\">
|
||||
</form>
|
||||
");
|
||||
setcookie("nazwa");
|
||||
setcookie("wizyty");
|
||||
} else if (isset($_POST["nazwa"])) {
|
||||
$nazwa = htmlspecialchars($_POST["nazwa"]);
|
||||
setcookie("nazwa", $nazwa);
|
||||
renderuj($nazwa);
|
||||
} elseif (strlen($_COOKIE["nazwa"] > 0)) {
|
||||
$nazwa = htmlspecialchars($_COOKIE["nazwa"]);
|
||||
renderuj($nazwa);
|
||||
} else {
|
||||
echo("
|
||||
<h2>Witaj!</h2>
|
||||
<form method=\"post\" action=\"/witalnia.php\">
|
||||
<input type=\"text\" name=\"nazwa\" required=\"\" placeholder=\"Wpisz swoją nazwę\">
|
||||
<input type=\"submit\" value=\"Zapisz\">
|
||||
</form>
|
||||
");
|
||||
}
|
||||
|
||||
?>
|
||||
</main>
|
||||
<footer-comp></footer-comp>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user