Skip to content

Instantly share code, notes, and snippets.

@makzan
Created September 15, 2017 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makzan/c8caf85e132eae5b1b3dc9117ce560b0 to your computer and use it in GitHub Desktop.
Save makzan/c8caf85e132eae5b1b3dc9117ce560b0 to your computer and use it in GitHub Desktop.
Guest room Wi-Fi
<?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