Created
September 15, 2017 16:34
-
-
Save makzan/c8caf85e132eae5b1b3dc9117ce560b0 to your computer and use it in GitHub Desktop.
Guest room Wi-Fi
This file contains 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 | |
$name = $_POST["name"] ?? ""; | |
$is_allowed = false; | |
if ($name == "Thomas") { | |
$is_allowed = true; | |
} | |
?> | |
<?php if ( !$is_allowed ): ?> | |
<?php | |
if ($name !== "") { | |
echo "<p>Incorrect guest name.</p>"; | |
} | |
?> | |
<form action="" method="POST"> | |
<p>Please input your name.</p> | |
Name: <input type="text" name="name"> | |
<input type="submit"> | |
</form> | |
<?php elseif ($is_allowed) : ?> | |
<h1>Welcome <?= $name ?></h1> | |
<p>The Wi-Fi passcode is <strong>13579</strong></p> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment