Mit Hilfe von PHP RGB ind HEX umwandeln function rgb2hex($rgb){ return sprintf(„%06X“, $rgb); } [/php]
Mit Hilfe von PHP RGB ind HEX umwandeln function rgb2hex($rgb){ return sprintf(„%06X“, $rgb); } [/php]
Einen Zufallsstring mit PHP erzeugen: function RandomString($len){ $randstr = “; srand((double)microtime()*1000000); for($i=0;$i<$len;$i++){ $n = rand(48,120); while (($n >= 58 && $n <= 64) || ($n >= 91 && $n <= 96)){ $n = rand(48,120); } $randstr .= chr($n); } return $randstr; } [/php] Quelle: Jonas John
Einen permanenten 301 Redirect in PHP realisieren.
Mit dem folgenden Codeschnipsel kann man mehrere IP Adressen blocken // Denied IP’s. $deny_ips = array( ‚127.0.0.1‘, ‚192.168.100.1‘, ‚192.168.200.1‘, ‚192.168.300.1‘, ‚xxx.xxx.xxx.xxx‘ ); // $deny_ips = file(‚blocked_ips.txt‘); // read user ip adress: $ip = isset($_SERVER[‚REMOTE_ADDR‘]) ? trim($_SERVER[‚REMOTE_ADDR‘]) : “; // search current IP in $deny_ips array if (($i = array_search($ip, $deny_ips)) !== FALSE){ // $i = […]