<?php

    $method = "POST";
    $islogin = false;
/*    if (isset($_GET["kod"]) && $_GET["kod"]==1111)
    {
        $islogin = true;
    }
*/
if (isset($_POST["kod"]))
    switch ($_POST["kod"]) 
    {
        case 1111:
        case 2222:
        case 3333:
        case 4444: 
            $islogin = true;
            break;

        default:
            $islogin = false;
            break;
    }


?>
<!DOCTYPE html>
<html lang="hu">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PHP form</title>
</head>
<body>
    
    <?php if ($islogin==false)
    { ?>
    <form method="<?php echo $method; ?>"> 
        <input type="text" name="nev" title="Adja meg a nevet"><br>
        <input type="number" name="kod" min=1000 max=9999 title="Adja meg a kódot"><br>
        <input type="submit" value="Belépés">
    </form>
    <?php
    }
    else
    {
        echo "<h1>Üdvözöllek ".$_POST["nev"]."</h1>";
        echo "<a href='harmadik.php'>Kijelentkezés</a>"; 
    }
    ?>

</body>
</html>

