1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
|
</table></td>
<td width="478" valign="top"><div align="justify">
</p>
<br>
<table width="97%" align="center" >
<tr>
<td><div align="justify">
<h4 align="center">
<?PHP
// neuen Eintrag speichern
$time=time();
$ip=$REMOTE_ADDR;
if ($aktion=="save")
{
if ($neuname<>"" AND $neueintrag<>"")
{
$sperrzeit=$time-$sperre*60;
$gesperrt=mysql_query("select id from Gaestebuch where ip='$ip' AND time>'$sperrzeit'");
if (mysql_num_rows($gesperrt)==0)
{
$neueintrag=htmlentities($neueintrag);
mysql_query("insert into Gaestebuch (name, mail, homepage, eintrag, kommentar, vote, time, ip) values ('$neuname', '$neumail', '$neuhomepage', '$neueintrag', '', '$neuvote', '$time', '$ip')");
// Mail senden
if ($admin_mail <> "")
{
$zeit = date("d.m.Y H:i",$time);
$mailtext="Eintrag von: $neuname \n";
$mailtext.="Mail: $neumail \n";
$mailtext.="geschrieben am: $zeit \n\n\n";
$mailtext.="$neueintrag\n\n";
mail($admin_mail, 'Sie haben einen neuen Gästebuch Eintrag.', $mailtext);
}
}
$aktion="";$neuname="";$neumail="";$neuhomepage="";$neueintrag="";$neuvote="";
}
}
// Gesamte Einträge auslesen und anzeigen
$abfrage=mysql_query("select count(id) from Gaestebuch");
$gesamt=mysql_result($abfrage,0,0);
mysql_free_result($abfrage);
echo"<font size=\"2\" color=\"$titel_color\">Es sind insgesamt $gesamt Einträge vorhanden.</font><br>\n";
// Durschnittsbewertung auslesen
$abfrage=mysql_query("select avg(vote) from Gaestebuch where vote>0");
$avgvote=mysql_result($abfrage,0,0);
mysql_free_result($abfrage);
$avgvote=round($avgvote,0);
if ($avgvote>0 AND $avgvote<=5)
{
if ($avgvote=="5") $avgvote="Sehr gut";
if ($avgvote=="4") $avgvote="Gut";
if ($avgvote=="3") $avgvote="ist O.K.";
if ($avgvote=="2") $avgvote="geht so";
if ($avgvote=="1") $avgvote="Schlecht";
echo"<font size=\"2\" color=\"$titel_color\">Im Durchschnitt wurde die Seite mit $avgvote bewertet.</font><br><br>\n";
}
else { echo"<font size=\"2\" color=\"$titel_color\">Sie haben noch keine Bewertung erhalten.</font><br><br>\n";}
echo" </td>\n";
echo" </tr>\n";
echo" <tr>\n";
echo" <td>\n";
// Neuen Eintrag eingeben
if($neuhomepage==""){$neuhomepage="http://";}
?>
</h4>
<table width="97%" align="center" cellpadding="2" cellspacing="0" <?PHP echo "bgcolor=\"$table_back\" style=\"border:solid $rahmen 1px;height:1px;\""; ?>>
<tr>
<td align="center"><a href="#" onClick="NeuerEintrag.style.display='block'" style="text-decoration:none"><?PHP echo"<font color=\"$text\"><strong>Jetzt ins Gästebuch eintragen</strong></font>";?></a><br>
<form name="NeuerEintrag" method="post" action="gaestebuch.php" <?PHP if ($aktion<>"save") {echo"style=\"display:none;\"";} ?>>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="right" valign="top"><?PHP echo"<font color=\"$text\">Name* : </font>";?></td>
<td width="400" align="left" valign="top"><input name="neuname" type="text" value="<?PHP echo $neuname; ?>" size="15"> </td>
</tr>
<tr>
<td align="right" valign="top"><?PHP echo"<font color=\"$text\">Mail : </font>";?></td>
<td align="left" valign="top"><input name="neumail" type="text" value="<?PHP echo $neumail; ?>" size="15">
<?PHP echo"<font size=\"2\" color=\"$text\">Ist nur dem Admin sichtbar.</font>";?></td>
</tr>
<tr>
<td align="right" valign="top"><?PHP echo"<font color=\"$text\">Homepage : </font>";?></td>
<td align="left" valign="top"><input name="neuhomepage" type="text" value="<?PHP echo $neuhomepage; ?>" size="15"></td>
</tr>
<tr>
<td align="right" valign="top"><?PHP echo"<font color=\"$text\">Bewertung : </font>";?></td>
<td align="left" valign="top"><select name="neuvote" size="1">
<option selected value="0">0 - Keine Angabe</option>
<option value="5">5 - Sehr gut</option>
<option value="4">4 - Gut</option>
<option value="3">3 - ist O.K.</option>
<option value="2">2 - geht so</option>
<option value="1">1 - Schlecht</option>
</select>
<?PHP echo"<font size=\"2\" color=\"$text\">Bitte bewerten Sie meine Seite.</font>";?></td>
</tr>
<tr>
<td align="right" valign="top"><?PHP echo"<font color=\"$text\">Kommentar* : </font>";?></td>
<td align="left" valign="top"><p>
<textarea name="neueintrag" cols="22" rows="6"><?PHP echo $neueintrag; ?></textarea>
</p>
<input type="submit" name="Submit" value="Jetzt eintragen">
<input type="reset" name="Submit2" value="Nee, doch nicht" onClick="NeuerEintrag.style.display='none'">
<br>
</p></td>
</tr>
</table>
<input name="aktion" type="hidden" id="aktion" value="save">
</form></td>
</tr>
</table>
<br>
<?PHP
// Navigation
if ($seite=="") {$seite=0;}
$start = $seite * $proseite;
$maxseite= floor($gesamt/$proseite)-1;
if ($seite>0 OR $seite<=$maxseite or $home_link<>"")
{
echo"<table width=\"97%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$table_back\">\n";
echo" <tr>\n";
echo" <td width=\"33%\" align=\"left\" nowrap>\n";
if ($seite>0){$pre=$seite-1; echo "<a href=\"gaestebuch.php?seite=$pre\" style=\"text-decoration:none\"><font size=\"2\" color=\"$text\"><strong>Vorherige Seite</strong></font></a>";}
echo" \n</td>\n";
echo" <td width=\"34%\" align=\"center\" nowrap> \n";
if ($home_link<>"") {echo" <a href=\"$home_link\" style=\"text-decoration:none\"><font size=\"2\" color=\"$text\"><strong>Home</strong></font></a>\n";}
echo" </td>\n";
echo" <td width=\"33%\" align=\"right\" nowrap>\n ";
if ($seite<=$maxseite){$vor=$seite+1; echo "<a href=\"gaestebuch.php?seite=$vor\" style=\"text-decoration:none\"><font size=\"2\" color=\"$text\"><strong>Nächste Seite</strong></font></a>\n";}
echo" </td>\n";
echo" </tr>\n";
echo"</table>\n<br>\n";
}
// Anzeige der Beiträge
$abfrage = "SELECT * from Gaestebuch ORDER BY ID DESC LIMIT $start, $proseite";
$ergebnis = mysql_query($abfrage);
while($row=mysql_fetch_array($ergebnis))
{
$id=$row['id'];
$name=$row['name'];
$homepage=$row['homepage'];
$eintrag=$row['eintrag'];
$kommentar=$row['kommentar'];
$vote=$row['vote'];
$mail=$row['mail'];
$ip=$row['ip'];
$time=$row['time'];
$datum = date("d.m.Y",$time);
$uhrzeit = date("H:i",$time);
if ($vote=="5") $vote="Sehr gut";
if ($vote=="4") $vote="Gut";
if ($vote=="3") $vote="ist O.K.";
if ($vote=="2") $vote="geht so";
if ($vote=="1") $vote="Schlecht";
?>
<table width="97%" align="center" cellpadding="0" cellspacing="0" <?PHP echo "bgcolor=\"$table_back\" style=\"border:solid $rahmen 1px;height:1px;\""; ?>>
<tr>
<td bgcolor="<?PHP echo $table_kopf; ?>"><table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td width="34%" align="left"><?PHP echo "<font size=\"2\" color=\"$text_kopf\"><strong>$name</strong></font>"; ?></td>
<td width="33%" align="center"><?PHP if ($homepage<>"" AND $homepage<>"http://"){echo "<a href=\"$homepage\" target=\"_blank\" style=\"text-decoration:none\"><font size=\"2\" color=\"$text_kopf\"><strong>Homepage</strong></font></a>";} ?></td>
<td width="33%" align="right"><?PHP echo "<font size=\"2\" color=\"$text_kopf\">$datum - ".$uhrzeit."Uhr</font>"; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="left"><?PHP
echo"<font color=\"$text\">";
echo nl2br($eintrag);
echo"</font>";
if($vote<>"0")
{echo"<br><br><font size=\"2\" color=\"$text_komm\">$name hat die Seite mit $vote bewertet.</font><br>";}
if($kommentar<>"")
{echo"<hr style=\"border:solid $rahmen 1px;height:1px;\">\n";
echo"<font size=\"2\" color=\"$text_komm\">Kommentar:<br>\n";
echo nl2br($kommentar);
echo"</font>\n";}
?>
<div align="center"></div></td>
</tr>
</table></td>
</tr>
</table>
<br>
<?PHP
}
// ENDE Anzeige der Beiträge
// Navigation
if ($seite=="") {$seite=0;}
$start = $seite * $proseite;
$maxseite= floor($gesamt/$proseite)-1;
if ($seite>0 OR $seite<=$maxseite or $admin_link<>"")
{
echo"<table width=\"97%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$table_back\">\n";
echo" <tr>\n";
echo" <td width=\"33%\" align=\"left\" nowrap>\n";
if ($seite>0){$pre=$seite-1; echo "<a href=\"gaestebuch.php?seite=$pre\" style=\"text-decoration:none\"><font size=\"2\" color=\"$text\"><strong>Vorherige Seite</strong></font></a>";}
echo" \n</td>\n";
echo" </td>\n";
echo" <td width=\"33%\" align=\"right\" nowrap>\n ";
if ($seite<=$maxseite){$vor=$seite+1; echo "<a href=\"gaestebuch.php?seite=$vor\" style=\"text-decoration:none\"><font size=\"2\" color=\"$text\"><strong>Nächste Seite</strong></font></a>\n";}
echo" </td>\n";
echo" </tr>\n";
echo"</table>\n<br>\n";
}
|