Se her...
<?
// The URL for \"Ordblinalyser\"
$ordblinurl = \'
http://kung-foo.dk/ordblin/\'; // The random words \"Ordblinalyser\" inserts in the page
$ordliste[] = \'flaske\';
$ordliste[] = \'nej\';
$ordliste[] = \'til\';
$ordliste[] = \'porno\';
$ordliste[] = \'at\';
$ordliste[] = \'a\';
$ordliste[] = \'e\';
$ordliste[] = \'burger\';
$ordliste[] = \'æ\';
$ordliste[] = \'ø\';
$ordliste[] = \'på en slem måde\';
$ordliste[] = \'å\';
$ordliste[] = \'tissefant\';
$ordliste[] = \'nef\';
$ordliste[] = \'erter\';
$ordliste[] = \'denm\';
$ordliste[] = \'baf\';
$ordliste[] = \'raf\';
$ordliste[] = \'lige i fissen\';
// A function that changes som Danish words. It\'s note made very clever...uses at lot of resources
function flipwords($str) {
$s = split(\" \", $str);
for($i=0; $i<count($s); $i++) {
if (eregi(\"^[a-z]+$\", $s[$i])) {
$s[$i] = str_replace(\'endnu\', \'inu\', $s[$i]);
$s[$i] = str_replace(\'hende\', \'hinde\', $s[$i]);
$s[$i] = str_replace(\'mig\', \'min\', $s[$i]);
$s[$i] = str_replace(\'mig\', \'min\', $s[$i]);
$s[$i] = str_replace(\'min\', \'mig\', $s[$i]);
$s[$i] = str_replace(\'han\', \'hun\', $s[$i]);
$s[$i] = str_replace(\'ham\', \'hende\', $s[$i]);
$s[$i] = str_replace(\'man\', \'han\', $s[$i]);
$s[$i] = str_replace(\'ja\', \'nej\', $s[$i]);
$s[$i] = str_replace(\'nej\', \'ja\', $s[$i]);
}
}
return implode(\' \', $s);
}
// A function that changes random letters with random letters
function ordblin($text) {
global $ordliste;
$text = flipwords($text);
$split = split(\' \', $text);
for($i=0; $i<count($split); $i++) {
if (preg_match(\"/^[a-z0-9]+$/i\", $split[$i])) {
rand(\'0\', \'15\') == 2 ? $split[$i] = $ordliste[rand(\'0\', count($ordliste))] : $split[$i] = $split[$i];
$split[$i] = preg_replace(\"/\".chr(rand(\'97\', \'120\')).\"/i\", chr(rand(\'97\', \'120\')), $split[$i]);
}
}
return implode(\' \', $split);
}
// Makes a pretty URL from a baseurl the the link
function makeurl($base, $path) {
if (preg_match(\"/^http:\\/\\/[^\\/]+$/i\", $base)) $base .= \'/\';
$base = ereg_replace(\"[^/]+$\", \"\", $base);
if (eregi(\'^
http://\', $path)) {
return $path;
}
else {
$path = ereg_replace( \"^(\\.){1}/\", \"\", $path);
if (ereg( \"^/\", $path)) {
$base = ereg_replace(\"^(http://([^/]+))/{1}(.*)\", \"\\\\1\", $base);
}
return $base.$path;
}
}
// Returns an array containing the head, body and type of the web page
function get($url) {
$urlArray = parse_url($url);
if (!$urlArray[port]) $urlArray[port] = \"80\";
if (!$urlArray[path]) $urlArray[path] = \"/\";
if ($urlArray[query]) $urlArray[path] .= \"?$urlArray[query]\";
$sock = fsockopen($urlArray[host], $urlArray[port]);
if ($sock) {
$dump .= \"GET $urlArray[path] HTTP/1.0\\r\\n\";
$dump .= \"Host: $urlArray[host]\\r\\nConnection: close\\r\\n\";
$dump .= \"User-Agent: Ordblinalyzer@kung-foo.dk\\r\\n\";
$dump .= \"Connection: close\\r\\n\\r\\n\";
fputs($sock, $dump);
while(!feof($sock)) $str .= fread($sock, 1024);
$pos = strpos($str, \"\\r\\n\\r\\n\");
$return[head] = substr($str, 0, $pos);
$return[body] = substr($str, $pos+4);
$return[type] = trim(ereg_replace(\".+\\nContent-Type: ?([^\\n;]+).*\", \"\\\\1\", $return[head]));
if (eregi(\"\\nLocation:\", $return[head])) $return = trim(ereg_replace(\".+\\nLocation: ?([^\\n]+).*\", \"\\\\1\", $return[head]));
fclose($sock);
return $return;
}
}
// Converts the funny %num in $url
if ($url) $url = rawurldecode($url);
// If no url, use mbn.dk...
if (!$url) $url = \'
http://mbn.dk/\'; // Collect information about the page
$get = get($url);
// The function returned an array... if not - something failed.
if (!is_array($get)) {
if (!preg_match(\"/^http:\\/\\//i\", $get)) print die(\"Nasty webserver... doesn\'t support HTTP...\");
header(\'Location: \'.$ordblinurl.\'?url=\'.rawurlencode($get));
}
// If no Content-Type - use text/html
if (!$get[type]) $get[type] = \'text/html\';
header(\"Content-Type: $get[type]\");
if ($get[type] == \'text/html\') {
$get[body] = preg_replace(\'/<script.*?<\\/script>/is\',\"\", $get[body]);
$get[body] = @preg_replace(\"/(href|src)\\s*=\\s*[\\\"\']*([^\\\"\'> ]+)[\\\"\']*/ei\", \"\'\\\\1\'.\'=\\\"$ordblinurl?url=\'.rawurlencode(makeurl(\'$url\', \'\\\\2\')).\'\\\"\'\", $get[body]);
$get[body] = preg_replace(\"/<(input|textarea)([^>]+)>/i\", \"<\\\\1\\\\2 disabled>\", $get[body]);
$get[body] = preg_replace(\"/<meta[^>]+>/i\", \"\", $get[body]);
$get[body] = preg_replace(\"/\\s*target\\s*=\\s*[\\\"\']_blank[\\\"\']\\s*/i\", \"\", $get[body]);
$get[body] = ordblin($get[body]);
}
// Outputs the stuff
print $get[body];
?>