Compare commits
No commits in common. "4c904551dca322cefecb2979d8993804af5c4780" and "a206ba2cf08af6203bbead16a95f80c47d1d4515" have entirely different histories.
4c904551dc
...
a206ba2cf0
10
index.php
10
index.php
@ -6,12 +6,13 @@ header("Cache-Control: no-cache, no-store, must-revalidate");
|
||||
|
||||
<?php
|
||||
|
||||
function get_color_from_userdata($data) {
|
||||
function get_color_from_ip($ip) {
|
||||
$ip_elem = explode(".", $ip);
|
||||
$css = "background-color: hsl(";
|
||||
$number = abs(crc32($data));
|
||||
$number = abs(crc32($ip));
|
||||
$css .= ($number % 360).", ";
|
||||
$css .= (50 + (($number >> 3) % 51))."%, ";
|
||||
$css .= (50 + (($number >> 5) % 31))."%);"; // maximal 80%, es soll nicht einfach weiß sein
|
||||
$css .= (50 + (($number >> 5) % 51))."%);";
|
||||
|
||||
return $css;
|
||||
}
|
||||
@ -46,8 +47,7 @@ if (array_key_exists("submitted", $_REQUEST)) {
|
||||
if ($botrequest) {
|
||||
$content .= "background-color: darksalmon; color: white;'>";
|
||||
} else {
|
||||
// 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)))."'>";
|
||||
$content .= get_color_from_ip($_SERVER['REMOTE_ADDR'])."'>";
|
||||
}
|
||||
|
||||
$ends_of_sentence = ['.', '!', '?'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user