Hey Community,
ich habe ein Gästebuch aus dem Internet geladen.
Codes:
Index.php:
eintrag.php:
gbinhalt.txt:
Problem: Alle Umlaute werden immer als Sysmbole etc. gespeichert (siehe gbinhalt.txt), obwohl alle FOrmulare UTF-8 Kodiert sind.
Wie schaffe ich es, dass die Umlaute richtig angezeigt werden?
Mit Hoffnung auf Hilfe,
Ich :P
ich habe ein Gästebuch aus dem Internet geladen.
Codes:
Index.php:
PHP Code:
<html>
<head>
<title>Gästebuch</title>
</head>
<style type="text/css">
/* Hintergrund
--------------------------------- */
body {
background-color: #c8d0db;
}
/* allgemeine Linkfarbe und Größe
--------------------------------- */
a:link {color: #0000CC; font: 13px arial, sans-serif;}
a:visited {color: #0000CC; font: 13px arial, sans-serif;}
a:active {color: #0000CC; font: 13px arial, sans-serif;}
a:hover {color: #0000CC; font: 13px arial, sans-serif;text-decoration:none;}
</style>
<body>
<p><img src="gaestebuch.png" alt="Hier können Sie sich in unser Gästebuch eintragen"></img></p>
Hier können Sie einen Beitrag im Gästebuch verfassen<br><br>
<form action="eintrag.php" Method="post">
Ihr Name:<br>
<input name="Name" size="30"><br><br>
E-Mail:<br>
<input name="E-Mail" size="30"><br>
<br><br>
Beitrag:<br>
<textarea name="inhalt" cols="30" rows="6"
wrap="physical"></textarea><br>
<input type="submit" value="Eintragen">
</form>
<hr color="#000080">
<font size="2">
<?php
$beitrag = file("gbinhalt.txt");
krsort($beitrag);
foreach($beitrag as $ausgabe)
{
$ausgabe = stripslashes($ausgabe);
$zerlegen = explode("|", $ausgabe);
echo "<font color=\"#330000\" size=\"2\">
<hr>
Eintrag von $zerlegen[1]
geschrieben am $zerlegen[2]
</td>
</tr>
<tr>
<td>
<br>
$zerlegen[3]
</td>
</tr>
</table><br>
";
}
?>
</font>
</body>
</html>
PHP Code:
<html>
<head>
<title>Gästebuch</title>
</head>
<style type="text/css">
/* Hintergrund
--------------------------------- */
body {
background-color: #c8d0db;
}
/* allgemeine Linkfarbe und Größe
--------------------------------- */
a:link {color: #0000CC; font: 13px arial, sans-serif;}
a:visited {color: #0000CC; font: 13px arial, sans-serif;}
a:active {color: #0000CC; font: 13px arial, sans-serif;}
a:hover {color: #0000CC; font: 13px arial, sans-serif;text-decoration:none;}
</style>
<body>
<?php
$user = $_POST["Name"];
$user = htmlentities($user);
$inhalt = $_POST["inhalt"];
$inhalt = htmlentities($inhalt);
$inhalt = str_replace("\n", "<br>", $inhalt);
$email = $_POST["EMail"];
$email = htmlentities($email);
if ($inhalt == "" or $user == "")
{
echo "Bitte füllen Sie das Feld \"Namen\"
und \"Inhalt\" aus";
}
else
{
$datum= date("d.m.Y H:i:s");
$eintrag="$email|$user|$datum|$inhalt";
$datei = fopen("gbinhalt.txt", "a");
fwrite($datei, "\n".$eintrag);
fclose($datei);
echo "Ihr Eintrag wurde in das Gästebuch eingetragen. Ihre eMail-Adresse
wird NICHT angezeigt.";
}
?>
<br>
<a href="gaestebuch.php">Zurück zum Gästebuch</a>
</body>
</html>
PHP Code:
|öäü|26.09.2012 18:32:20|öäü
Wie schaffe ich es, dass die Umlaute richtig angezeigt werden?
Mit Hoffnung auf Hilfe,
Ich :P