Compare commits
2 Commits
a206ba2cf0
...
4c904551dc
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c904551dc | |||
| 350445a58c |
10
index.php
10
index.php
@ -6,13 +6,12 @@ header("Cache-Control: no-cache, no-store, must-revalidate");
|
||||
|
||||
<?php
|
||||
|
||||
function get_color_from_ip($ip) {
|
||||
$ip_elem = explode(".", $ip);
|
||||
function get_color_from_userdata($data) {
|
||||
$css = "background-color: hsl(";
|
||||
$number = abs(crc32($ip));
|
||||
$number = abs(crc32($data));
|
||||
$css .= ($number % 360).", ";
|
||||
$css .= (50 + (($number >> 3) % 51))."%, ";
|
||||
$css .= (50 + (($number >> 5) % 51))."%);";
|
||||
$css .= (50 + (($number >> 5) % 31))."%);"; // maximal 80%, es soll nicht einfach weiß sein
|
||||
|
||||
return $css;
|
||||
}
|
||||
@ -47,7 +46,8 @@ if (array_key_exists("submitted", $_REQUEST)) {
|
||||
if ($botrequest) {
|
||||
$content .= "background-color: darksalmon; color: white;'>";
|
||||
} else {
|
||||
$content .= get_color_from_ip($_SERVER['REMOTE_ADDR'])."'>";
|
||||
// Farbe hängt ab von Benutzer und ändert sich nach gewisser Zeit.
|
||||
$content .= get_color_from_userdata($_REQUEST["user"].strval(intdiv(time(),60*60*24*7)))."'>";
|
||||
}
|
||||
|
||||
$ends_of_sentence = ['.', '!', '?'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user