unexpected $end In Datei
Hallo zusammen!
Wenn ich diese Webseite aurufen will, bekomme ich immer nur die Browserausgabe "Parse error: syntax error, unexpected $end in /usr/export/www/vhosts/funnetwork/hosting/stefanbenkoe/gThr478gzu256sw2i.php on line 100" zu sehen:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Pressefuzzis Seite >> Bericht verfassen</title>
<link rel='stylesheet' type='text/css' href='stil.css'>
</head>
<body>
<?php
if (isset($_POST['subm']) && $_POST['wort'] == xyz) {
echo <<<HEREDOC1
<div style="position:absolute; left:1%; top:1%; width:21%; height:75%;">
<p> <<a href="pass.html">A¹-Jugend</a>></p>
<p> <<a href="pass.html">B¹-Jugend</a>></p>
<p> <<a href="pass.html">B²-Jugend</a>></p>
<p> <<a href="pass.html">C¹-Jugend</a>></p>
<p> <<a href="pass.html">D¹-Jugend</a>></p>
<p> <<a href="pass.html">E¹-Jugend</a>></p>
<p> <<a href="pass.html">E²-Jugend</a>></p>
<p> <<a href="pass.html">E³-Jugend</a>></p>
<p> <<a href="pass.html">F¹-Jugend</a>></p>
<p> <<a href="pass.html">F²-Jugend</a>></p>
<p> <<a href="pass.html">F³-Jugend</a>></p>
<p> <<a href="pass.html">G¹-Jugend</a>></p>
</div>
<div style="position:absolute; top:77%; left:1%; width:14%; height:20%;">
Login für den<br />
<br />
<<a href="pass.html">Pressefuzzi</a>>
</div>
<div style="position:absolute; left:1%; top:96%; background-color:#00dfff; height:2%;">
designed by Markus Benkö
</div>
<div id="hl" style="position:absolute; top:77%; left:16%; width:6.9%; height:17.2%;">
</div>
<div style="position:absolute; left:25%; top:1%; width:74%; height:98%;">
</div>
<div style="position:absolute; left:35%; top:5%; width:62%; height:94%;">
<h2>Bericht verfassen</h2>
<form action="gThr478gzu256sw2i.php" method='post'>
<textarea cols='50' rows='20' name='bericht'>
</textarea>
<p><input type='submit' value="Eintragen!" name="subm2"></p>
</form>
HEREDOC1;
if (isset($_POST['subm2']) && !empty($_POST['bericht'])) {
$bericht = $_POST['bericht'];
$bericht = htmlspecialchars($bericht);
$bericht = stripe_tags($bericht);
$bericht = nl2br($bericht);
$fp = fopen("berichte.txt", 'a+');
fputs($fp, $bericht);
echo "Dateieingabe erfolgreich!";
fclose($fp);
}
echo "</div>";
}
else {
echo <<<HEREDOC2
<div style="position:absolute; left:1%; top:1%; width:21%; height:75%;">
<p> <<a href="pass.html">A¹-Jugend</a>></p>
<p> <<a href="pass.html">B¹-Jugend</a>></p>
<p> <<a href="pass.html">B²-Jugend</a>></p>
<p> <<a href="pass.html">C¹-Jugend</a>></p>
<p> <<a href="pass.html">D¹-Jugend</a>></p>
<p> <<a href="pass.html">E¹-Jugend</a>></p>
<p> <<a href="pass.html">E²-Jugend</a>></p>
<p> <<a href="pass.html">E³-Jugend</a>></p>
<p> <<a href="pass.html">F¹-Jugend</a>></p>
<p> <<a href="pass.html">F²-Jugend</a>></p>
<p> <<a href="pass.html">F³-Jugend</a>></p>
<p> <<a href="pass.html">G¹-Jugend</a>></p>
</div>
<div style="position:absolute; top:77%; left:1%; width:14%; height:20%;">
Login für den<br />
<br />
<<a href="pass.html">Pressefuzzi</a>>
</div>
<div style="position:absolute; left:1%; top:96%; background-color:#00dfff; height:2%;">
designed by Markus Benkö
</div>
<div id="hl" style="position:absolute; top:77%; left:16%; width:6.9%; height:17.2%;">
</div>
<div style="position:absolute; left:25%; top:1%; width:74%; height:98%;">
</div>
<div style="position:absolute; left:35%; top:5%; width:62%; height:94%;">
<h2>Das Passwort ist falsch!</h2>
Benutzen Sie bitte den <a href="pass.html">Zurück-Button</a> Ihres Browsers und<br />
versuchen Sie es noch einmal.
</div>
HEREDOC2;
}
?>
</body>
</html>
Antwort schreiben
Antwort 1 von Woo vom 08.08.2019, 18:06 Options
Bei dem Quellcode ist es sehr schwer was zu erkennen, aber diese Meldung kommt normalerweise, wenn eine Klammer irgendwo fehlt.
Antwort 2 von greg68 vom 08.08.2019, 18:15 Options
Es fehlen eine Menge Zeichen. Z.B. Im Echo-Block würde ich die Anführungsstriche " mal mit ' ersetzen.
Viel Arbeit...
Antwort 3 von Amateur-Googler vom 09.08.2019, 10:25 Options
Danke erstmal für die Antworten,
welche Zeichen fehlen denn?
Ich habe auch schon mit einem Editor die öffnenden und schließenden
Klammern gezählt, da ist keine zu wenig (oder zuviel).
Antwort 4 von Amateur-Googler vom 10.08.2019, 11:06 Options
Ich hab den Fehler jetzt gefunden: hinter einem HEREDOC war ein Leerzeichen. *schäm*
Antwort 5 von ClemBra vom 10.08.2019, 22:35 Options
Interessante Anweisung, ich hab das bisher immer mit
// PHP-Code
?>
<!--HTML-->
<?php
// Weiterer PHP-Code
gemacht.
Antwort 6 von Amateur-Googler vom 19.08.2019, 11:10 Options
Hier bin ich schon wieder :-(
Wenn man nun auf "subm2" klickt, kommt man nur zu einer leeren Seite.
<?php
echo <<<HEREDOCII
<form action="gThr478gzu256sw2i.php" method='post'>
<input type='hidden' name="manns" value="{$_POST[mann]}">
Das Spiel war ein<br />
<input type='radio' name="modus" value="heimspiel"> Heimspiel <input type='radio' name="modus" value="auswarts"> Auswärtsspiel <span style="font-style: italic;">gegen</span>
<input type='text' name="gegner" maxlength='50' value="
HEREDOCII;
if (isset($_POST['gegner'])) {
$gegner = $_POST['gegner'];
echo "$gegner";
}
echo <<<HEREDOCIII
">
<p>
Halbzeitergebnis: <input type='text' name="herg" maxlength='5' size='2'> // Ergebnisse bitte nach diesem Muster eintragen:<br />
Endergebnis: <input type='text' name="erg" maxlength='5' size='2'> [Zahl 1]<span style="font-weight: bold;">:</span>[Zahl 2].\\\</p>
Bericht:<br /><textarea cols='50' rows='20' name="bericht">
HEREDOCIII;
if (isset($_POST['bericht'])) {
$bericht = $_POST['bericht'];
echo "$bericht";
}
echo <<<HEREDOCIV
</textarea><br />
<input type='submit' value="Eintragen!" name="subm2" />
</form>
HEREDOCIV;
if (isset($_POST['subm2']) && !empty($_POST['gegner']) && !empty($_POST['herg']) && !empty($_POST['erg']) && !empty($_POST['modus'])) {
if (isset($_POST['bericht'])) {
$bericht = $_POST['bericht'];
$bericht = htmlspecialchars($bericht);
$bericht = nl2br($bericht);
}
$gegner = $_POST['gegner'];
$gegner = htmlspecialchars($gegner);
$mannsc = $_POST['manns'];
$herg = $_POST['herg'];
$erg = $_POST['erg'];
$modus = $_POST['modus'];
if (isset($_POST['bericht'])) {
$eintrag = "insert into presse () values ('$mannsc', '$gegner', '$modus', '$herg', '$erg', '$bericht')";
}
else {
$eintrag = "insert into presse () values ('$mannsc', '$gegner', '$modus', '$herg', '$erg', '')";
}
include ("zugriff.php");
if (mysql_query($eintrag)) {
echo "<h2>Dateneingabe erfolgreich!</h2><a href='index.html'>Ausloggen</a>";
}
else {
echo "<h2>Dateneingabe nicht erfolgreich</h2>Benutzen Sie bitte den <a href='javascript:history.back()'>Zurück-Button</a> ihres Browsers<br />
und versuchen Sie es noch einmal.";
}
mysql_close();
}
?>