accepts bot entries and marks them with a comment
This commit is contained in:
parent
1eef45693e
commit
8440c10e14
17
index.php
17
index.php
@ -26,9 +26,22 @@ if (!is_dir("data")) {
|
||||
if (array_key_exists("submitted", $_REQUEST)) {
|
||||
$word = urldecode($_REQUEST["submitted"]);
|
||||
//print("Jemand schreibt ".$word."<br>");
|
||||
|
||||
$botrequest = false;
|
||||
|
||||
if (isset($_REQUEST["bot"])) {
|
||||
$botrequest = true;
|
||||
$content .= "<!-- FranzelbertML -->";
|
||||
}
|
||||
|
||||
$sentences = fopen("./data/sentences.txt", "a") or die("unable to open sentences file");
|
||||
$content = "<span style='";
|
||||
|
||||
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 .= "<!-- FranzelbertML -->";
|
||||
}
|
||||
|
||||
$content .= "</span>";
|
||||
|
||||
if (in_array($word[-1], $ends_of_sentence)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user