link: http://nxter.uttx.net/gaestebuch.php
fehler: fehlermeldungen seht ihr ja selbst ![]()
script:
HTML
// Relevante Variablen auslesen
if (isset($_GET['seite'])) {$seite = $_GET['seite']; }
if (isset($_POST['aktion'])) {$aktion = $_POST['aktion']; }
// vor allen Ausgaben muss die Session gestartet werden falls Spamschutz aktiv
!!!
if ($stopspam=="1")
{
session_start();
if (isset($_SESSION["sessioncode"])) {
$sessioncode=$_SESSION["sessioncode"]; }
}
// mit der Datenbank verbinden:
$serverID = @mysql_connect($db_host, $db_user, $db_pass);
if(!$serverID) {echo "Der DB Server ist im Moment leider nicht erreichbar!";}
$datenbank=@mysql_select_db($db_name, $serverID);
// HTML
?>
<html>
<head>
<title><?=$titel?></title>
</head>
<body>
<?PHP
// neuen Eintrag speichern
$time=time();
$ip=$REMOTE_ADDR;
if ($aktion == "save")
{
$fehler=0;
// Relevante Variablen auslesen
$neuname = $_POST['neuname'];
$neumail = $_POST['neumail'];
$neuhomepage = $_POST['neuhomepage'];
$neueintrag = $_POST['neueintrag'];
$neuvote = $_POST['neuvote'];
$neucode = $_POST['neucode'];
// auf Pflichfelder Prüfen
if ($neuname=="" OR $neueintrag=="")
{$fehler=1; $fehlerstring="Sie haben nicht alle Pflichtfelder
ausgefüllt.";}
// auf Spam Prüfen
if ($stopspam=="1" AND $fehler == 0 AND $sessioncode <> md5($neucode) )
{$fehler=1; $fehlerstring="Der Anti Spam Code ist falsch.";}
// auf IP Sperre Prüfen
if ($fehler == 0)
{
$sperrzeit=$time-$sperre*60;
$gesperrt=mysql_query("select id from Gaestebuch where ip='$ip'
AND time>'$sperrzeit'");
if (mysql_num_rows($gesperrt)<>0)
{
$fehler = 1; $fehlerstring="IP Sperre.";
$aktion="";$neuname="";$neumail="";$neuhomepage="";$neueintrag="";$neuvote="";
}
}
// Wenn alles ok dann Eintragen
if ($fehler == 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="";
}
}
// Anzeige Überschrift und align vorgabe
echo"<table width=\"550\" border=\"0\" cellpadding=\"0\"
cellspacing=\"0\" align=\"$align\">\n";
echo" <tr>\n";
echo" <td align=\"center\">\n";
echo"<font size=\"5\" color=\"$titel_color\">$titel</font>
\n";
// 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>
\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>
\n";
}
else { echo"<font size=\"2\" color=\"$titel_color\">Sie haben noch keine
Bewertung erhalten.</font>
\n";}
echo" </td>\n";
echo" </tr>\n";
echo" <tr>\n";
echo" <td>\n";
// Fehler beim Speichern Ausgeben
if ($fehler == 1)
{echo "<font color=\"$text\">$fehlerstring</font>
\n";}
// Neuen Eintrag eingeben
if($neuhomepage==""){$neuhomepage="http://";}
?>
<table width="550" 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\">[b]Jetzt ins
Gästebuch eintragen[/b]</font>";?></a>
<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="bottom"><input name="neuname"
type="text" value="<?PHP echo $neuname; ?>" size="25">
</td>
</tr>
<tr>
<td align="right" valign="top"><?PHP echo"<font
color=\"$text\">Mail:</font>";?></td>
<td align="left" valign="bottom"><input name="neumail" type="text"
value="<?PHP echo $neumail; ?>" size="25">
<?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="bottom"><input name="neuhomepage" type="text"
value="<?PHP echo $neuhomepage; ?>" size="25"></td>
</tr>
<tr>
<td align="right" valign="top"><?PHP echo"<font
color=\"$text\">Bewertung:</font>";?></td>
<td align="left" valign="bottom">
<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>
<?PHP
if ($stopspam=="1")
{
echo" <tr>\n";
echo" <td align=\"right\" valign=\"top\"><font
color=\"$text\">AntiSpam:</font></td>\n";
echo" <td align=\"left\" valign=\"bottom\"><img
src=\"nospam.php?".session_name()."=".session_id()."\" align=\"absmiddle\"
alt=\"Anti Spam\" style=\"border:solid $rahmen 1px;\"><font size=\"2\"
color=\"$text\">=</font><input name=\"neucode\" type=\"text\" size=\"4\">\n";
echo" <font size=\"2\" color=\"$text\">Antispam
Code</font></td>\n";
echo" </tr>\n";
}
?>
<tr>
<td align="right" valign="top"><?PHP echo"<font
color=\"$text\">Kommentar*:</font>";?></td>
<td align="left" valign="top">
<textarea name="neueintrag" cols="45" rows="6"><?PHP echo $neueintrag;
?></textarea>
<input type="submit" name="Submit" value="Jetzt
eintragen">
<input type="reset" name="Submit2" value="Nee, doch nicht"
onClick="NeuerEintrag.style.display='none'">
</td>
</tr>
</table>
<input type="hidden" name="<?PHP echo session_name(); ?>" value="<?PHP echo
session_id(); ?>">
<input type="hidden" name="aktion" value="save">
</form>
</td></tr></table>
<?PHP
// Navigation
if ($seite=="") {$seite=0;}
$start = $seite * $proseite;
$maxseite= ($gesamt/$proseite)-1;
if ($seite>0 OR $seite<=$maxseite or $home_link<>"")
{
echo"<table width=\"550\" 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\">[b]Vorherige Seite[/b]</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\">[b]Home[/b]</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\">[b]Nächste Seite[/b]</font></a>\n";}
echo" </td>\n";
echo" </tr>\n";
echo"</table>\n
\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="550" 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" cellspacing="0" cellpadding="1">
<tr>
<td width="34%" align="left"><?PHP echo "<font size=\"2\"
color=\"$text_kopf\">[b]$name[/b]</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\">[b]Homepage[/b]</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"
<font size=\"2\"
color=\"$text_komm\">$name hat die Seite mit $vote bewertet.</font>
";}
if($kommentar<>"")
{echo"<hr style=\"border:solid $rahmen
1px;height:1px;\">\n";
echo"<font size=\"2\"
color=\"$text_komm\">Kommentar:
\n";
echo nl2br($kommentar);
echo"</font>\n";}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?PHP
}
// ENDE Anzeige der Beiträge
// Navigation
if ($seite=="") {$seite=0;}
$start = $seite * $proseite;
$maxseite= ($gesamt/$proseite)-1;
if ($seite>0 OR $seite<=$maxseite or $admin_link<>"")
{
echo"<table width=\"550\" 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\">[b]Vorherige Seite[/b]</font></a>";}
echo" \n</td>\n";
echo" <td width=\"34%\" align=\"center\" nowrap>\n";
if ($admin_link<>"") {echo" <a href=\"$admin_link\"
style=\"text-decoration:none\"><font size=\"2\"
color=\"$text\">[b]Admin[/b]</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\">[b]Nächste Seite[/b]</font></a>\n";}
echo" </td>\n";
echo" </tr>\n";
echo"</table>\n
\n";
}
//ende align vorgabe
echo" </td>\n";
echo" </tr>\n";
// der Copyright Hinweis darf nicht entfernt werden !!!
echo" <tr><td align=\"center\" nowrap><a href=\"http://www.Pawlita.de\"
target=\"_blank\" style=\"text-decoration:none\"><font size=\"2\"
color=\"$text_komm\">Gästebuch v1.4 ©Pawlita.de</font></a></td></tr>\n";
echo"</table>\n";
// HTML Ende
?>
</body>
</html>
Alles anzeigen
Ich wäre froh wenn mir jemand helfen könnte diese Fehler wegzumachen!
mfg