Schokoriegel
Mitglied
Code:
<? include('config.php');?>
<?php
$HOST="$dbhost";
$DB="$dbname";
$USER="$dbuser";
$PWD="$dbpass";
//Datenbank Verbindung Pruefen
$dberror="
<head>
<title>Datanbank Fehler</title>
</head>
<body>
<p>Momentan besteht keine Verbindung zur SQL Datenbank.<br>
Ich bitte Sie um Entschuldigung und versuchen Sie es später nochmals.<br>
</p>
</body>
</html>
";
@mysql_connect($HOST,$USER,$PWD) or die ("" .$dberror);
//Anzahl Eintraege pro Seite
$Zeilen_pro_Seite=15;
$conn_id = mysql_connect($HOST,$USER,$PWD);
mysql_select_db($DB,$conn_id);
$ipadresse_entry=getenv("REMOTE_ADDR");
if($submit)
{
if($name_entry=="")
{
echo "<p>Fehler: Es wurde kein Name Angegeben!<br> <a href=\"javascript:history.back()\" class=extlink>Zurück</a>.</p>";
exit();
}
elseif($kommentar_entry=="")
{
echo "<p>Fehler: Es wurde kein Komentar Angegeben!<br> <a href=\"javascript:history.back()\" class=extlink>Zurück</a>.</p>";
exit();
}
elseif($email_entry=="")
{
echo "<p>Fehler: Es wurde keine Email Angegeben!<br> <a href=\"javascript:history.back()\" class=extlink>Zurück</a>.</p>";
exit();
}
else
{
$datum_entry=time();
mysql_query("INSERT INTO guestbook VALUES ('', '$datum_entry', '$name_entry', '$wohnort_entry', '$email_entry', '$icq_entry', '$homepage_entry', '$kommentar_entry', '$ipadresse_entry')");
echo "<p><center>Vielen Dank für Ihren Gästebuch Eintrag!<br>
<a href=\".../index.php?inhalt=gb/guestbook\">Einträge ansehen</a>.</p></center>";
exit();
}
}
?>
<style type="text/css">
<!--
.Stil1 {font-size: 10px}
.Stil2 {font-size: 12px; }
.Stil4 {font-size: 12px; font-family: Georgia, "Times New Roman", Times, serif; }
-->
</style>
<form action="gb/guestbook.php" method="post" name="guestbook" >
<div align="center">
<br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td width="100" height="25">
<p align="left" class="Stil2">Name:</p>
</td>
<td>
<div align="left" class="Stil2">
<input type="text" name="name_entry" maxlength="30" size="15">
</div></td>
</tr>
<tr>
<td height="25"><div align="left" class="Stil2">Wohnort:</div></td>
<td><div align="left" class="Stil2">
<input type="text" name="wohnort_entry" maxlength="30" size="15">
</div></td>
</tr>
<tr>
<td width="100" height="25">
<p align="left" class="Stil2">E-Mail:</p>
</td>
<td>
<div align="left" class="Stil2">
<input type="text" name="email_entry" maxlength="150" size="15">
</div></td>
</tr>
<tr>
<td height="25"><div align="left" class="Stil2">ICQ</div></td>
<td><div align="left" class="Stil2">
<input type="text" name="icq_entry" maxlength="150" size="15">
</div></td>
</tr>
<tr>
<td width="100" height="25">
<p align="left" class="Stil2">Homepage:</p>
</td>
<td>
<div align="left" class="Stil2">
<input type="text" name="homepage_entry" maxlength="200" size="15" value="http://">
</div></td>
</tr>
<tr>
<td width="100" valign="top">
<p align="left" class="Stil2">Kommentar:</p>
</td>
<td valign="top">
<p align="left" class="Stil2">
<textarea cols="25" rows="5" name="kommentar_entry"></textarea><br>
<img src="gb/image/1.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':zwink:'" >
<img src="gb/image/2.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':lach:'" >
<img src="gb/image/3.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':laugh:'" >
<img src="gb/image/4.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':eek:'" >
<img src="gb/image/5.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':frage:'" >
<img src="gb/image/6.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':cool:'" >
<img src="gb/image/7.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':tongue:'" >
<img src="gb/image/8.gif" onclick="document.guestbook.kommentar_entry.value = document.guestbook.kommentar_entry.value + ':D'" >
</td>
</tr>
<tr>
<td>
<br>
</td>
<td height="25">
<div align="left" class="Stil2">
<input type="Submit" name="submit" value="Eintragen">
<input type="Reset" name="reset" value="Löschen">
</div></td>
</tr>
</table>
<div align="center"><span class="Stil1"><span class="Stil4"><a href="gb/login.php">Admin</a></span></span> <br>
</div>
</div>
</form>
<div align="center">
<div align="center">
<div align="center"><br>
<table width="447" border="1" cellspacing="0" bordercolor="#000000" bgcolor="#0066CC">
<?php
$conn_id = mysql_connect($HOST,$USER,$PWD);
mysql_select_db($DB,$conn_id);
if (!isset($st))
{
$st = 0;
}
$query = "SELECT * from guestbook ORDER BY id DESC limit $st, $Zeilen_pro_Seite";
$result = mysql_query($query);
$result1=mysql_query("select * from guestbook ORDER BY id DESC");
$Anzahl=mysql_num_rows($result1);
if (mysql_num_rows($result)) {
while($row=mysql_fetch_array($result))
{
$row['kommentar']= ereg_replace(":zwink:)", "<img src=gb/image/1.gif", $row['kommentar'] );
$row['kommentar_entry'] = ereg_replace(":lach:", "<img src=gb/image/2.gif>", $row['kommentar'] );
$row['kommentar']= ereg_replace(":laugh:", "<img src=gb/image/3.gif>", $row['kommentar'] );
$row['kommentar'] = ereg_replace(":eek:", "<img src=gb/image/4.gif>", $row['kommentar'] );
$row['kommentar'] = ereg_replace(":frage:", "<img src=gb/image/5.gif>", $row['kommentar'] );
$row['kommentar'] = ereg_replace(":cool:", "<img src=gb/image/6.gif>", $row['kommentar'] );
$row['kommentar'] = ereg_replace(":tongue:", "<img src=gb/image/7.gif>", $row['kommentar'] );
$row['kommentar']= ereg_replace(":D", "<img src=gb/image/8.gif>", $row['kommentar'] );
$id = $row['id'];
$datum = $row['datum'];
$name = $row['name'];
$wohnort = $row['wohnort'];
$email = $row['email'];
$icq = $row['icq'];
$homepage = $row['homepage'];
$kommentar = $row['kommentar'];
$ipadresse = $row['ipadresse'];
$array_1 = array("ä","ü","ö");
$array_2 = array("ä","ü","ö");
$datum_ausgabe=date("d. m. Y", $datum);
$zeit_ausgabe=date("H:i", $datum);
$kommentar=strip_tags($kommentar);
$kommentar=str_replace($array_1,$array_2,$kommentar);
$kommentar=nl2br($kommentar);
$kommentar_neu=wordwrap($kommentar,80);
if($email!="")
{
$email_link="<a href=\"mailto:$email\"><img src=\"gb/image/mail.gif\" border=\"0\"></a>";
}
else
{
$email_link="";
}
if($homepage!="http://")
{
$homepage_link="<a href=\"$homepage\" target=\"_blank\"><img src=\"gb/image/www.gif\" border=\"0\"></a>";
}
else
{
$homepage_link="";
}
if($icq!="")
{
$icq_link="<a href=\"http://web.icq.com/whitepages/about_me?Uin='.$icq.'\" target=\"_blank\"><img src=\"http://wwp.icq.com/scripts/online.dll?icq=$icq&img=5\" border=0 alt=\"ICQ-Nummer: $icq\"></a>";
}
else
{
$icq_link="";
}
echo "
<table width=\"447\" border=\"1\" cellspacing=\"0\" bordercolor=\"#000000\" bgcolor=\"#0066CC\">
<tr>
<td bgcolor=\"#0099FF\"><p align=\"left\"><b>$name</b> aus $wohnort schrieb am $datum_ausgabe um $zeit_ausgabe Uhr</p></td>
<td width=\"60\" rowspan=\"2\" valign=\"top\"><div align=\"left\">$email_link $homepage_link $icq_link </div></td>
</tr>
<tr>
<td colspan><div align=\"left\">$kommentar_neu</div></td>
</tr></table><br><br>
";
flush();
}
}
else
{
echo " <table width=\"447\" border=\"1\" cellspacing=\"0\" bordercolor=\"#000000\" bgcolor=\"#0066CC\"><tr><td colspan=\"5\"><p><center>Keine Einträge vorhanden!</center> </p></td></tr>\n</table>";
}
echo "<table width=\"447\" border=\"0\" cellspacing=\"0\" bgcolor=\"#0066CC\"><tr>
<td>";
if($Anzahl>$Zeilen_pro_Seite) {
$Seiten=intval($Anzahl/$Zeilen_pro_Seite);
if($Anzahl%$Zeilen_pro_Seite) {
$Seiten++;
echo "<p>Seite: ";
}
}
for ($i=1;$i<=$Seiten;$i++) {
$fwd=($i-1)*$Zeilen_pro_Seite;
echo "<a href=\"gb/guestbook?st=$fwd\" class=extlink>[$i]</a> ";
}
echo "</td></tr>";
echo"\n";
?></table>