Browse Source

dokonceni ukolu

master
Ivan Pomykacz 7 months ago
parent
commit
2cb45405ac
  1. 1
      .gitignore
  2. 40
      index.php

1
.gitignore

@ -0,0 +1 @@
Thumbs.db

40
index.php

@ -5,7 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ahoj světe!</title>
</head>
<body>
<?php
$color = "green";
?>
<body style="background-color: <?php echo $color ?>;">
<?php
// vypsat aktuální datum
@ -15,7 +18,7 @@ date_default_timezone_set('Europe/Prague');
echo date('Y-m-d H:i:s');
echo "<br>";
$random_index = random_int(0, 2);
$images = [
"earth1.webp",
@ -23,6 +26,8 @@ $images = [
"earth3.jpg",
];
$random_index = random_int(0, count($images) - 1);
// var_dump($images);
$random_image = $images[$random_index];
@ -31,6 +36,37 @@ $random_image = $images[$random_index];
<img src="<?php echo $random_image; ?>" alt="Earth image" width="300">
<?php
// echo date("Ymd");
$name_days = [
20241002 => "Olívie, Olivia, Oliver",
20241003 => "Bohumil",
// ...
20241016 => "Havel",
// ...
];
echo "<h2>Dnes má svátek: " . $name_days[date("Ymd")] . "</h2>";
?>
<h2>Výpis obsahu adresáře</h2>
<?php
$dir = '.';
$files1 = scandir($dir);
// print_r($files1);
echo "<ul>";
foreach ($files1 as $item) {
echo "<li>$item</li>";
}
echo "</ul>";
?>
</body>
</html>

Loading…
Cancel
Save