69 -> 70
This commit is contained in:
		
							
								
								
									
										22
									
								
								zaklady/.project
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								zaklady/.project
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<projectDescription>
 | 
			
		||||
	<name>PHP_DS_Project</name>
 | 
			
		||||
	<comment></comment>
 | 
			
		||||
	<projects>
 | 
			
		||||
	</projects>
 | 
			
		||||
	<buildSpec>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.wst.validation.validationbuilder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.dltk.core.scriptbuilder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
	</buildSpec>
 | 
			
		||||
	<natures>
 | 
			
		||||
		<nature>org.eclipse.php.core.PHPNature</nature>
 | 
			
		||||
	</natures>
 | 
			
		||||
</projectDescription>
 | 
			
		||||
							
								
								
									
										7
									
								
								zaklady/index.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								zaklady/index.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
// Podmínky a elseif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										278
									
								
								zaklady/odkladiste.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										278
									
								
								zaklady/odkladiste.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,278 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
// Přepisování proměnných (statické a dynamické typování)
 | 
			
		||||
$name = "Lukáš";
 | 
			
		||||
$adult = true;
 | 
			
		||||
echo $name;
 | 
			
		||||
echo "<br>";
 | 
			
		||||
// Pravda, nepravda = true, false
 | 
			
		||||
$kolej = false;
 | 
			
		||||
$adult = false;
 | 
			
		||||
 | 
			
		||||
$is_logged = true;
 | 
			
		||||
$database_connection = false;
 | 
			
		||||
 | 
			
		||||
echo "Přihlášení uživatele: $is_logged";
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo "Napojení do databáze: $database_connection";
 | 
			
		||||
 | 
			
		||||
// Null
 | 
			
		||||
$kolej = null;
 | 
			
		||||
echo $kolej;
 | 
			
		||||
 | 
			
		||||
$kolej = "Nebelvír";
 | 
			
		||||
echo $kolej;
 | 
			
		||||
 | 
			
		||||
// Matematické operace
 | 
			
		||||
$students_2022 = 100;
 | 
			
		||||
$students_2023 = 124;
 | 
			
		||||
 | 
			
		||||
$results = $students_2022 - $students_2023 * 5;
 | 
			
		||||
$results2 = $students_2022 + $students_2023;
 | 
			
		||||
$results3 = $students_2022 * $students_2023 ;
 | 
			
		||||
$results4 = $students_2022 / $students_2023;
 | 
			
		||||
echo "Výsledek: $results";
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo "Výsledek: $results2";
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo "Výsledek: $results3";
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo "Výsledek: $results4";
 | 
			
		||||
 | 
			
		||||
// Spojování proměnných
 | 
			
		||||
$first_name = "Harry";
 | 
			
		||||
$second_name = "Potter";
 | 
			
		||||
$friend_first_name = "Ron";
 | 
			
		||||
 | 
			
		||||
echo $first_name . " " . $second_name;
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo $first_name. " a " .$friend_first_name;   
 | 
			
		||||
 | 
			
		||||
// Type conversion
 | 
			
		||||
$year_price = "1500";
 | 
			
		||||
$year_caunt = "7";
 | 
			
		||||
 | 
			
		||||
$results_price = $year_price * $year_caunt;
 | 
			
		||||
 | 
			
		||||
echo $results_price;
 | 
			
		||||
echo "<br>";
 | 
			
		||||
var_dump($results_price);
 | 
			
		||||
echo "<br>";
 | 
			
		||||
var_dump($year_caunt);
 | 
			
		||||
 | 
			
		||||
// Negace
 | 
			
		||||
$database_connection1 = true;
 | 
			
		||||
var_dump(!$database_connection1);
 | 
			
		||||
 | 
			
		||||
// Pole (array)
 | 
			
		||||
 | 
			
		||||
$students = ["Harry", "Ron", "Hermiona"];
 | 
			
		||||
$students2 = [1 => "Harry",  65 => "Ron", "Hermiona"];
 | 
			
		||||
 | 
			
		||||
echo $students[1];
 | 
			
		||||
echo "<br>";
 | 
			
		||||
var_dump($students);
 | 
			
		||||
echo "<br>";
 | 
			
		||||
var_dump($students2);
 | 
			
		||||
 | 
			
		||||
// Asociatvní pole
 | 
			
		||||
 | 
			
		||||
$students3 = [
 | 
			
		||||
    "first_name" => "Harry",
 | 
			
		||||
    "second_name" => "Potter",
 | 
			
		||||
    "college" => "Nebelvír",
 | 
			
		||||
    "age" => 15
 | 
			
		||||
];
 | 
			
		||||
echo $students3["second_name"];
 | 
			
		||||
 | 
			
		||||
// Dvoudimenzionální pole (pole v poli)
 | 
			
		||||
$students4 = [
 | 
			
		||||
    [
 | 
			
		||||
        "first_name" => "Harry",
 | 
			
		||||
        "second_name" => "Potter",
 | 
			
		||||
        "age" => 15
 | 
			
		||||
    ],
 | 
			
		||||
    ["first_name" => "Hermiona",
 | 
			
		||||
        "second_name" => "Grangerová",
 | 
			
		||||
        "age" => 14
 | 
			
		||||
        ],
 | 
			
		||||
    ["first_name" => "Ron",
 | 
			
		||||
        "second_name" => "Weasly",
 | 
			
		||||
        "age" => 15],
 | 
			
		||||
];
 | 
			
		||||
var_dump($students4);
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo $students4[0]["first_name"];
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo $students4[2]["second_name"];
 | 
			
		||||
 | 
			
		||||
// Foreach cyklus
 | 
			
		||||
$students5 = ["Harry", "Ron", "Hermiona", "Malfoy"];
 | 
			
		||||
foreach ($students5 as $index => $one_student5) {
 | 
			
		||||
    $index++;
 | 
			
		||||
    echo $index.". " . $one_student5;
 | 
			
		||||
    echo "<br>";
 | 
			
		||||
    
 | 
			
		||||
    // Foreach cyklus
 | 
			
		||||
    $students6 = [
 | 
			
		||||
        "jmeno" => "Harry",
 | 
			
		||||
        "prijmeni" => "Potter",
 | 
			
		||||
        "kolej" => "Nebelvír",
 | 
			
		||||
        "vek" => 15
 | 
			
		||||
    ];
 | 
			
		||||
    
 | 
			
		||||
    foreach ($students6 as $index1 => $one_information) {
 | 
			
		||||
        echo $index1.": ".$one_information;
 | 
			
		||||
        echo "<br>";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Cyklus foreach - na práci s polem
 | 
			
		||||
// Cyklus for
 | 
			
		||||
for ($i = 1; $i <= 30; $i++) {
 | 
			
		||||
    echo $i. " .Harry";
 | 
			
		||||
    echo '<br>';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Cyklus foreach - na práci s polem
 | 
			
		||||
// Cyklus for - kolikrát se má cyklus provést
 | 
			
		||||
for($y = 1; $y <= 5; $y++) {
 | 
			
		||||
    echo "<a href='./stranky/stranka$y.php'>Další stránka</a>";
 | 
			
		||||
echo "<br>";
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Cyklus foreach - na práci s polem
 | 
			
		||||
// Cyklus for - kolikrát se má cyklus provést
 | 
			
		||||
// Cyklus while - while cyklus znamená dokud - nevíme kolikrát (provádí se dokud platí podmínka)
 | 
			
		||||
$month = 1;
 | 
			
		||||
while ($month <=12){
 | 
			
		||||
    echo $month;
 | 
			
		||||
    echo "<br>";
 | 
			
		||||
    $month = $month + 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$test_questions = ["1. otázka", "2. otázka", "3. otázka", "4. otázka", "5. otázka"];
 | 
			
		||||
$maximum = 2;
 | 
			
		||||
$counter = 0;
 | 
			
		||||
 | 
			
		||||
while($counter < $maximum) {
 | 
			
		||||
    echo $test_questions[$counter];
 | 
			
		||||
    echo "<br>";
 | 
			
		||||
    $counter++;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Podmínky
 | 
			
		||||
if (5 > 20) {
 | 
			
		||||
    echo "Ano, je to pravda";
 | 
			
		||||
} else {
 | 
			
		||||
    echo "Není to pravda";
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//Podmínky a empty
 | 
			
		||||
$articles = [];
 | 
			
		||||
 | 
			
		||||
var_dump(empty($articles));
 | 
			
		||||
echo "<br>";
 | 
			
		||||
 | 
			
		||||
if (empty($articles)) {
 | 
			
		||||
    echo "Neexistují žádné články";
 | 
			
		||||
 | 
			
		||||
    exit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VYpsání článků z databáze
 | 
			
		||||
echo "<br>";
 | 
			
		||||
echo 'Další kód na stránce';
 | 
			
		||||
 | 
			
		||||
// Podmínky a elseif
 | 
			
		||||
$hour =15;
 | 
			
		||||
$message = null;
 | 
			
		||||
 | 
			
		||||
if($hour< 9) {
 | 
			
		||||
    $message = "Dobré ráno";
 | 
			
		||||
} elseif ($hour < 12) {
 | 
			
		||||
    $message = "Dobré dopoledne";
 | 
			
		||||
} elseif ($hour == 12) {
 | 
			
		||||
    $message = "Dobré poledne";
 | 
			
		||||
} elseif ($hour < 18) {
 | 
			
		||||
    $message = "Dobré odpoledne";
 | 
			
		||||
} else {
 | 
			
		||||
    $message = "Dobrý večer";
 | 
			
		||||
}
 | 
			
		||||
echo $message;
 | 
			
		||||
 | 
			
		||||
// Podmínky a logické operátory - and, or
 | 
			
		||||
 | 
			
		||||
$age = 25;
 | 
			
		||||
 | 
			
		||||
if($age >= 18 and $age < 65) {
 | 
			
		||||
    echo "Dospělí není v důchodovém věku";
 | 
			
		||||
} elseif ($age < 18){
 | 
			
		||||
    echo "Dospívající";
 | 
			
		||||
} else {
 | 
			
		||||
    echo "Důchodce";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
and - a zároveň
 | 
			
		||||
true, true -> true
 | 
			
		||||
true, false -> false
 | 
			
		||||
false, true -> false
 | 
			
		||||
false, false -> false
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Podmínky a logické operátory - and, or
 | 
			
		||||
// 12345, 66778
 | 
			
		||||
 | 
			
		||||
$password = "12345";
 | 
			
		||||
 | 
			
		||||
if($password === "12345" or $password === "66778") {
 | 
			
		||||
    echo "Dveře se otvírají, můžete jít dál";
 | 
			
		||||
} else {
 | 
			
		||||
 echo "Neplatný kód. Zkuste to prosím znovu";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// or - nebo
 | 
			
		||||
// true, true -> true
 | 
			
		||||
// true, false -> true
 | 
			
		||||
// false, true -> true
 | 
			
		||||
// false, false -> false
 | 
			
		||||
 | 
			
		||||
// Switch statement
 | 
			
		||||
$day = "po";
 | 
			
		||||
 | 
			
		||||
switch ($day) {
 | 
			
		||||
    case "po":
 | 
			
		||||
        echo "Pondělí";
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
        case "ut":
 | 
			
		||||
            echo "Úterý";
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
            case "st":
 | 
			
		||||
                echo "Středa";
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
                case "ct":
 | 
			
		||||
                    echo "Čtvrtek";
 | 
			
		||||
                    break;
 | 
			
		||||
 | 
			
		||||
                    case "pa":
 | 
			
		||||
                        echo "Pátek";
 | 
			
		||||
                        break;
 | 
			
		||||
 | 
			
		||||
                        case "so":
 | 
			
		||||
                            echo "Sobota";
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                            case "ne":
 | 
			
		||||
                                echo "Neděle";
 | 
			
		||||
                                break;
 | 
			
		||||
 | 
			
		||||
                                default:
 | 
			
		||||
                                    echo "Neznámý den";
 | 
			
		||||
                                    break;
 | 
			
		||||
 | 
			
		||||
} 
 | 
			
		||||
							
								
								
									
										17
									
								
								zaklady/stranky/stranka1.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								zaklady/stranky/stranka1.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<!--
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
 | 
			
		||||
-->
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="UTF-8">
 | 
			
		||||
        <title></title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
        <h1>Nová stránka 1</h1>
 | 
			
		||||
        <?php
 | 
			
		||||
        // put your code here
 | 
			
		||||
        ?>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										18
									
								
								zaklady/stranky/stranka2.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								zaklady/stranky/stranka2.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<!--
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
 | 
			
		||||
-->
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="UTF-8">
 | 
			
		||||
        <title></title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
                <h1>Nová stránka 2</h1>
 | 
			
		||||
 | 
			
		||||
        <?php
 | 
			
		||||
        // put your code here
 | 
			
		||||
        ?>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										18
									
								
								zaklady/stranky/stranka3.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								zaklady/stranky/stranka3.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<!--
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
 | 
			
		||||
-->
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="UTF-8">
 | 
			
		||||
        <title></title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
                <h1>Nová stránka 3</h1>
 | 
			
		||||
 | 
			
		||||
        <?php
 | 
			
		||||
        // put your code here
 | 
			
		||||
        ?>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										18
									
								
								zaklady/stranky/stranka4.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								zaklady/stranky/stranka4.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<!--
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
 | 
			
		||||
-->
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="UTF-8">
 | 
			
		||||
        <title></title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
                <h1>Nová stránka 4</h1>
 | 
			
		||||
 | 
			
		||||
        <?php
 | 
			
		||||
        // put your code here
 | 
			
		||||
        ?>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										18
									
								
								zaklady/stranky/stranka5.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								zaklady/stranky/stranka5.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<!--
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 | 
			
		||||
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
 | 
			
		||||
-->
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="UTF-8">
 | 
			
		||||
        <title></title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
                <h1>Nová stránka 5</h1>
 | 
			
		||||
 | 
			
		||||
        <?php
 | 
			
		||||
        // put your code here
 | 
			
		||||
        ?>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user