Skip to content

Instantly share code, notes, and snippets.

@vporoshok
Created May 27, 2017 08:19
Show Gist options
  • Save vporoshok/2e93ac21243f6156615ba36f70f6a72a to your computer and use it in GitHub Desktop.
Save vporoshok/2e93ac21243f6156615ba36f70f6a72a to your computer and use it in GitHub Desktop.
<?php
session_start();
$sender = $_SESSION['email'];
if (strlen($sender) === 0) {
http_response_code(401);
echo('Unauthorized');
exit();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$message = $_POST['message'];
$receiver = $_POST['receiver'];
echo("Send $message to $receiver");
}
?>
<p>Hello, <?php echo($sender) ?>!</p>
<form method="post">
<input name="message" placeholder="message"><br>
<input name="receiver" placeholder="receiver"><br>
<button>Send</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment