header("Cache-control: no-cache, must revalidate");
header("Pragma: no-cache");
include ("conf/loadinc.php");
$connection = mysql_connect($server, $dbuser, $dbpassword) or die ('Konnte Datenbank nich öffnen');
$db = mysql_select_db($datenbank, $connection) or die ('Konnte tabelle nich öffnen');
if ($action=="")
{
$header = readtpl("header");
echo $header;
if ($eintragensamesite==1)
{
$eintragen = "
\n";
echo $eintragen;
}
else
{
echo "Hier eintragen
";
}
$sql = "select id, datum, name, email, land, stadt, eintrag, remoteip, status from eintraege where status=0 order by datum desc";
$result = mysql_query($sql) or die ('Fehler in der Abfrage');
while (list($id, $datum, $name, $email, $land, $stadt, $eintrag, $remoteip, $status) = mysql_fetch_row($result))
{
$inhalt = readtpl("gbinhalt_loop");
$inhalt = str_replace("##id##", $id, $inhalt);
$inhalt = str_replace("##datum##", $datum, $inhalt);
$inhalt = str_replace("##name##", $name, $inhalt);
$inhalt = str_replace("##email##", "$email", $inhalt);
$inhalt = str_replace("##land##", $land, $inhalt);
$inhalt = str_replace("##stadt##", $stadt, $inhalt);
$inhalt = str_replace("##eintrag##", $eintrag, $inhalt);
if ($zeigeips==1) $inhalt = str_replace("##remoteip##", $remoteip, $inhalt);
else $inhalt = str_replace("##remoteip##", "*bekannt*", $inhalt);
echo $inhalt;
}
$footer = readtpl("footer");
$footer = str_replace("##generiert##", date("d.m.Y H:i:s"), $footer);
echo $footer;
}
elseif ($action=="hinzufuegen")
{
$datum = date ("Y-m-d H:i:s");
$eintrag = strip_tags($eintrag);
$eintrag = nl2br($eintrag);
$sql = "insert into eintraege (datum, name, email, land, stadt, eintrag, remoteip, status) values ('$datum', '$name', '$email', '$land', '$stadt', '$eintrag', '$REMOTE_ADDR', '0')";
$result = mysql_query($sql) or die ('Fehler in der Abfrage');
echo readtpl("dankefuereintrag");
}
elseif ($action=="eintrageformular")
{
echo readtpl("header");
$eintragen = "\n";
echo $eintragen;
echo readtpl("footer");
}
?>