$value) { $value = utf8_decode($value); switch ($value) { case "": $value = '-'; break; case "Mahnst. 0: Kontoauszug vor Mahnung": $value = '{\b\cf11 ' . $value . '}'; break; case "Mahnst. 1: Zahlungserinnerung": $value = '{\b\cf7 ' . $value . '}'; break; case "Mahnst. 2: RA-Androhung": $value = '{\b\cf6 ' . $value . '}'; break; } $doc = preg_replace('/\<' . strtolower($key) . '\>/i', $value, $doc); } $doc = preg_replace('/\/i', date("d.m.Y"), $doc); if (true) { $fd = fopen('temp/Beitreibungsauftrag.rtf', 'w'); fwrite($fd, $doc); fclose($fd); echo ''; } else { $length = strlen($doc); $filename = "Beitreibungsauftrag_" . $_GET['KNDNR'] . ".rtf"; header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private', false); header('Content-Description: File Transfer'); header('Content-Type: application/rtf'); header('Content-Length: "' . $length . '"'); header('Content-Disposition: attachment; filename="' . $filename . '"'); echo $doc; } /* $_GET ( [report] => /qbuilder/phpME_report_1183144753.php [KNAME] => 843487 - SCHAUB GmbH [KNDNR] => 843487 [Kstra] => Postfach 101 552 [Kdplz] => 86885 [Kdort] => Landsberg [Ktelf] => [BelNr] => VGGF135000115 [ReDat] => 18.06.2013 [Verka] => 155 - Eray Cakirogullari [Betri] => LL - NA [OffBe] => -145,00 [RechBe] => -145,00 [Mahnst] => [NextMahnst] => ) */ ?>