From 8440c10e1493bfde968b43e4431fbf229dd3d184 Mon Sep 17 00:00:00 2001 From: Tristan Schneider Date: Sat, 23 Jan 2021 19:24:55 +0100 Subject: [PATCH] accepts bot entries and marks them with a comment --- index.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 1b0c6a6..0e8c089 100644 --- a/index.php +++ b/index.php @@ -26,9 +26,22 @@ if (!is_dir("data")) { if (array_key_exists("submitted", $_REQUEST)) { $word = urldecode($_REQUEST["submitted"]); //print("Jemand schreibt ".$word."
"); + + $botrequest = false; + + if (isset($_REQUEST["bot"])) { + $botrequest = true; + $content .= ""; + } + $sentences = fopen("./data/sentences.txt", "a") or die("unable to open sentences file"); $content = ""; + + if ($botrequest) { + $content .= "background-color: darksalmon; color: white;'>"; + } else { + $content .= get_color_from_ip($_SERVER['REMOTE_ADDR'])."'>"; + } $ends_of_sentence = ['.', '!', '?']; if (preg_match("/\p{L}/", $word[0])) { // check if first character is letter (including ä, ê, ß stuff) @@ -36,6 +49,10 @@ if (array_key_exists("submitted", $_REQUEST)) { } $content .= htmlentities($word); + if ($botrequest) { + $content .= ""; + } + $content .= ""; if (in_array($word[-1], $ends_of_sentence)) {