<?php
-define('API_KEY', 'ABC123#@!');
-define('DROP_EXPIRY_SECONDS', (24 * 3600) + 2375); // 24h 39min 35sec (one martian day)
-define('DEAD_DROP_DIR', './Dead-drops');
-define('DROP_LIMIT', 1024); // maximum amount of hot dead drops
-define('CSRF_TOKEN_LIFETIME', 600);
-define('IGNORED_DROPS', [ // list permanent drops (test purposes)
+define('API_KEY', 'ABC123'); // API key for What3Words
+define('DROP_EXPIRY_SECONDS', (24 * 3600) + 2375); // 24h 39min 35sec
+define('DEAD_DROP_DIR', './Dead-drops'); // path to the directory with messages
+define('DROP_LIMIT', 1024); // maximum amount of hot dead drops
+define('CSRF_TOKEN_LIFETIME', 600); // it is what is says...
+define('IGNORED_DROPS', [ // list permanent drops (test purposes)
'62a5bced62e7219c8e164d64fdae67900476ed54f39c5851a07bb65b590e04df'
]);
+define('TEXT_BOTTOM','
+ example text, that will be shown on bellow the form on landing page only
+');
+
require_once 'captcha.php';
// === main.php ===
function deadDropUI() {
session_start();
$session_id_key = 'csrf_token_session_id';
+ $text_bottom = TEXT_BOTTOM;
if (!isset($_SESSION['csrf_token'], $_SESSION['csrf_token_time'], $_SESSION[$session_id_key]) ||
session_id() !== $_SESSION[$session_id_key] ||
if ($result['mode'] === 'readonly' && $result['status'] === 'cold') {
if ($dropCount > DROP_LIMIT) {
- echo "There is too much heat on this domain right now to stash a new message. Come back later.";
+ echo "<center>There is too much heat on this domain right now to stash a new message. Come back later.</center>";
return;
}
$slowDown = checkDropRate();
if ($slowDown) {
if (captcha($token, $result['w3w']) !== 'YAY') return;
}
- echo "<h3>" . htmlentities($result['w3w']) ."</h3>This drop is cold. You can stash your message here.<br><br>";
+ echo "<h3><center>" . htmlentities($result['w3w']) ."</h3><center>This drop is cold. You can stash your message here.</center><br><br>";
echo <<<HTML
+ <center>
<form method="post">
<input type="hidden" name="csrf_token" value="{$token}">
<input type="hidden" name="originalW3W" value="{$result['w3w']}">
<textarea name="stashContent" maxlength="4096" rows="10" cols="60" placeholder="max 4096 chars" required></textarea><br>
<input type="submit" value="Stash">
</form>
+<br><br>
+</center>
HTML;
return;
}
if ($result['mode'] === 'initial' ||
($result['mode'] === 'readonly' && $result['status'] === 'invalid')) {
echo <<<HTML
+<center>
<style>input[type="text"],input[type="submit"] { font-size: 16.5px; }</style>
<form method="post">
<label><a href="https://www.what3words.com/" target="_blank">?</a> </label>
<input type="text" id="inputString" name="inputString" placeholder="///what.three.words (English)" size="30" maxlength="50" required>
<input type="submit" value="Check">
</form>
+</center>
+<br><br>
+</p>
+$text_bottom
HTML;
}
if ($result['mode'] === 'readonly') {
if ($result['status'] === 'hot') {
- echo "<pre>" . htmlspecialchars($result['decrypted'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . "</pre>";
- echo <<<HTML
+ echo "<pre><div style='
+ background: #000;
+ border: 1px solid #000;
+ border-left: 5px solid #000;
+ color: white;
+ font-weight: bold;
+ page-break-inside: avoid;
+ font-family: monospace;
+ font-size: 15px;
+ line-height: 1.6;
+ margin-bottom: 1.6em;
+ max-width: 100%;
+ overflow-x: auto;
+ white-space: nowrap;
+ padding: 1em 1.5em;
+ display: block;
+ word-wrap: break-word;
+ white-space: pre-wrap;
+ '>" . htmlspecialchars($result['decrypted'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . "</div></pre>";
+ echo <<<HTML
+<center>
<form method="post">
<input type="hidden" name="csrf_token" value="{$token}">
<input type="hidden" name="burnW3W" value="{$result['w3w']}">
<input type="submit" value="Burn message">
-</form>
+</form><br><br>
+</center>
+
HTML;
} elseif ($result['status'] === 'invalid') {
- echo "<br>{$result['message']}";
+ echo "<center><br>{$result['message']}</center>";
}
} elseif ($result['mode'] === 'stashed') {
- echo "<h3>Message stashed at " . htmlentities($result['w3w']) ."</h3>Your dead drop is hot.";
+ echo "<center><h3>Message stashed at " . htmlentities($result['w3w']) ."</h3>Your dead drop is hot.</center><br><br>";
}
}