PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
php gästebuch tut komm nicht weiter
Beitrag
<blockquote data-quote="Momo22m" data-source="post: 1592506" data-attributes="member: 421106"><p><strong>AW: php gästebuch tut komm nicht weiter</strong></p><p></p><p>so hab mal wieder so gemacht wie ich es denke </p><p></p><p>da kommt der fehler</p><p></p><p>[CODE][B]Parse error[/B]: syntax error, unexpected '}' in [B]C:\Program Files\xampp\htdocs\page\gb.php[/B] on line [B]112[/B][/CODE]</p><p></p><p>und 112 ist nur } else</p><p></p><p>so ich schreib auch mal den code rein wie ich ihn geschrieben habe </p><p></p><p>[CODE]<form action="/book_action" method="post"></p><p><table summary="eintrag hinterlassen"></p><p><tr></p><p><td>Name:</td></p><p><td><input type="text" name="name" size="70" /></td></p><p></tr></p><p><tr></p><p><td>Email:</td></p><p><td><input type="text" name="mail" size="70" /></td></p><p></tr></p><p><tr></p><p><td>Homepage:</td></p><p><td><input type="text" name="hp" size="70" value="http://" /></td></p><p></tr></p><p><tr></p><p><td>Text:</td></p><p><td><br/></td></p><p></tr></p><p><tr></p><p><td colspan="2"><textarea name="text" cols="63" rows="5"></textarea></td></p><p></tr></p><p><tr><td><br/></td></tr></p><p><tr></p><p><td style="text-align:center;" colspan="2"><img src="captcha/captcha.php" border="0" title="Sicherheitscode" width="140" height="40" alt="Sicherheitscode" /><br/></p><p><input type="text" name="sicherheitscode" size="20" /></td></p><p></tr></p><p><tr><td><br/></td></tr></p><p><tr></p><p><td><input type="submit" value="eintragen" /></td></p><p><td style="text-align:right;"><input type="reset" name="formsend" value="abbrechen" /></td></p><p></tr></p><p></table></p><p></form></p><p></p><p><?php </p><p></p><p>session_start(); if ('POST' == $_SERVER['REQUEST_METHOD']) {</p><p>if (!isset($_POST['name'], $_POST['mail'], $_POST['text'],$_POST['hp'], $_POST['formsend'])) {</p><p>die ('Benutzen sie nur Formulare von der Homepage.');</p><p>}</p><p>} else {</p><p>if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam'])</p><p>{</p><p>unset($_SESSION['captcha_spam']);</p><p></p><p>$name = $_POST['name'];</p><p>$mail = $_POST['mail'];</p><p>$hp = $_POST['hp'];</p><p>$text = $_POST['text'];</p><p></p><p>###################################</p><p></p><p>//Welche Felder ausgefüllt werden müssen</p><p>if ($name == ""</p><p>|| $mail == ""</p><p>|| $text == ""</p><p>) {</p><p></p><p>$error = "yes";</p><p>echo "<Script>alert('Bitte überprüfen Sie, ob alle Pflichtfelder ausgefüllt sind!)</script>";</p><p>echo "<Script>history.back(-1)</script>";</p><p>exit();</p><p>}</p><p></p><p>if ($hp == "http://")</p><p>{</p><p>$hp = "";</p><p>}</p><p></p><p>// E-Mail-Adresse wird geprüft</p><p>if (!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,3})$", $mail))</p><p>{</p><p>$error = "yes";</p><p>echo "<Script>alert('Bitte prüfen Sie, ob Ihre E-Mail-Adresse korrekt ist!')</script>";</p><p>echo "<Script>history.back(-1)</script>";</p><p>exit();</p><p>} } }</p><p></p><p>if ($error != "yes")</p><p>{</p><p>db_connect();</p><p>$sql="insert into book(von,mail,hp,text,am) values('".mysql_real_escape_string(htmlentities($name)).</p><p>"','".htmlentities(mysql_real_escape_string($mail)).</p><p>"','".htmlentities(mysql_real_escape_string($hp)).</p><p>"','".htmlentities(mysql_real_escape_string($text))."',NOW())";</p><p>$result = mysql_query($sql);</p><p>db_disconnect();</p><p></p><p>//Fehler</p><p>if ($result!="")</p><p>{</p><p>echo "<Script>window.location='/book'</script>";</p><p>exit();</p><p>}</p><p>else</p><p>{</p><p>echo "<Script>alert('Ein Fehler ist aufgetreten!')</script>";</p><p>echo "<Script>history.back(-1)</script>";</p><p>exit();</p><p>}</p><p>include('config.php');</p><p></p><p></p><p>//Wenn nicht alles ausgefüllt wurde</p><p>} else</p><p>{</p><p>echo "<Script>alert('Ein Fehler ist aufgetreten! Bitte prüfen Sie Ihre eingaben!')</script>";</p><p>echo "<Script>history.back(-1)</script>";</p><p>exit();</p><p>}</p><p>//Falsches Captcha</p><p>} else</p><p>{</p><p>echo "<Script>alert('Ein Fehler ist aufgetreten! Bitte prüfen Sie Ihre eingaben!')</script>";</p><p>echo "<Script>history.back(-1)</script>";</p><p>exit();</p><p>}</p><p>$i=1;</p><p>$zahl=0;</p><p>$show=10;</p><p></p><p>db_connect();</p><p>$result_a = mysql_query("select count(id) as anz, max(id) as maxi from book");</p><p>$anz = mysql_fetch_assoc($result_a);</p><p>$max = $anz['anz'];</p><p>$mid = $anz['maxi'];</p><p>$seiten = ($max / $show) +1;</p><p>mysql_free_result($result_a);</p><p></p><p>echo "<table class='book' summary='gaestebuch'><tr><td>" . $max . " Einträge auf " . (int)$seiten . " Seiten</td><td>Seite ";</p><p>while ($i <= $seiten)</p><p>{</p><p>echo "<a href='index.php?side=book&id=" . $mid . "&t=" . $zahl . "'>". $i . "</a> | ";</p><p></p><p>$result_b = mysql_query("select id from book where id <=" . $mid . " order by id desc LIMIT " . $show);</p><p>while ($sid = mysql_fetch_array($result_b)) { $sarray[$i] = $sid['id']; }</p><p>$mid = min($sarray)-1;</p><p>mysql_free_result($result_b);</p><p></p><p>$zahl = $zahl + $show;</p><p>$i++;</p><p>}</p><p>echo "</td></tr></table><table class='book' summary='einträge'>";</p><p>$i=0;</p><p></p><p></p><p>$result = mysql_query("select id,von,mail,hp,text, DATE_FORMAT(am,'%d.%m.%Y') as datum from book where id <=" . $id . " order by id desc LIMIT " . $show);</p><p>while($liste = mysql_fetch_array($result))</p><p>{</p><p>$text = str_replace(</p><p>array('ä', 'ö', 'ü', 'ß'),</p><p>array('&auml;', '&ouml;', '&uuml;', '&szlig;'),</p><p>$liste['text']</p><p>);</p><p>$text = nl2br($text);</p><p></p><p>$wert = $max - $i - $it;</p><p>echo "<tr class=\"gbhead\">";</p><p>echo "<th style='width:400px;'><a href='mailto:" . $liste['mail'] . "'>" . $liste['von'] . "</a> schrieb am " . $liste['datum'] ."</th>";</p><p>echo "<td>Eintrag Nr: " . $wert . "</td></tr><tr>";</p><p>echo "<td colspan='2'>" . $text . "</td></tr><tr><td></td></tr>";</p><p>if ($liste['hp'] != "")</p><p>{</p><p>echo "<tr><td colspan='2'>Homepage: <a href='" . $liste['hp'] . "' target='_blank'>" . $liste['hp'] . "</a></td></tr>";</p><p>}</p><p>echo "<tr><td><br/><br/></td></tr>";</p><p>$i++;</p><p>}</p><p>mysql_free_result($result);</p><p>db_disconnect();</p><p></p><p>?>[/CODE]</p><p></p><p>hoffe es kann einer sagen was ich falsch mache </p><p></p><p>mfg Momo</p></blockquote><p></p>
[QUOTE="Momo22m, post: 1592506, member: 421106"] [b]AW: php gästebuch tut komm nicht weiter[/b] so hab mal wieder so gemacht wie ich es denke da kommt der fehler [CODE][B]Parse error[/B]: syntax error, unexpected '}' in [B]C:\Program Files\xampp\htdocs\page\gb.php[/B] on line [B]112[/B][/CODE] und 112 ist nur } else so ich schreib auch mal den code rein wie ich ihn geschrieben habe [CODE]<form action="/book_action" method="post"> <table summary="eintrag hinterlassen"> <tr> <td>Name:</td> <td><input type="text" name="name" size="70" /></td> </tr> <tr> <td>Email:</td> <td><input type="text" name="mail" size="70" /></td> </tr> <tr> <td>Homepage:</td> <td><input type="text" name="hp" size="70" value="http://" /></td> </tr> <tr> <td>Text:</td> <td><br/></td> </tr> <tr> <td colspan="2"><textarea name="text" cols="63" rows="5"></textarea></td> </tr> <tr><td><br/></td></tr> <tr> <td style="text-align:center;" colspan="2"><img src="captcha/captcha.php" border="0" title="Sicherheitscode" width="140" height="40" alt="Sicherheitscode" /><br/> <input type="text" name="sicherheitscode" size="20" /></td> </tr> <tr><td><br/></td></tr> <tr> <td><input type="submit" value="eintragen" /></td> <td style="text-align:right;"><input type="reset" name="formsend" value="abbrechen" /></td> </tr> </table> </form> <?php session_start(); if ('POST' == $_SERVER['REQUEST_METHOD']) { if (!isset($_POST['name'], $_POST['mail'], $_POST['text'],$_POST['hp'], $_POST['formsend'])) { die ('Benutzen sie nur Formulare von der Homepage.'); } } else { if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']) { unset($_SESSION['captcha_spam']); $name = $_POST['name']; $mail = $_POST['mail']; $hp = $_POST['hp']; $text = $_POST['text']; ################################### //Welche Felder ausgefüllt werden müssen if ($name == "" || $mail == "" || $text == "" ) { $error = "yes"; echo "<Script>alert('Bitte überprüfen Sie, ob alle Pflichtfelder ausgefüllt sind!)</script>"; echo "<Script>history.back(-1)</script>"; exit(); } if ($hp == "http://") { $hp = ""; } // E-Mail-Adresse wird geprüft if (!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,3})$", $mail)) { $error = "yes"; echo "<Script>alert('Bitte prüfen Sie, ob Ihre E-Mail-Adresse korrekt ist!')</script>"; echo "<Script>history.back(-1)</script>"; exit(); } } } if ($error != "yes") { db_connect(); $sql="insert into book(von,mail,hp,text,am) values('".mysql_real_escape_string(htmlentities($name)). "','".htmlentities(mysql_real_escape_string($mail)). "','".htmlentities(mysql_real_escape_string($hp)). "','".htmlentities(mysql_real_escape_string($text))."',NOW())"; $result = mysql_query($sql); db_disconnect(); //Fehler if ($result!="") { echo "<Script>window.location='/book'</script>"; exit(); } else { echo "<Script>alert('Ein Fehler ist aufgetreten!')</script>"; echo "<Script>history.back(-1)</script>"; exit(); } include('config.php'); //Wenn nicht alles ausgefüllt wurde } else { echo "<Script>alert('Ein Fehler ist aufgetreten! Bitte prüfen Sie Ihre eingaben!')</script>"; echo "<Script>history.back(-1)</script>"; exit(); } //Falsches Captcha } else { echo "<Script>alert('Ein Fehler ist aufgetreten! Bitte prüfen Sie Ihre eingaben!')</script>"; echo "<Script>history.back(-1)</script>"; exit(); } $i=1; $zahl=0; $show=10; db_connect(); $result_a = mysql_query("select count(id) as anz, max(id) as maxi from book"); $anz = mysql_fetch_assoc($result_a); $max = $anz['anz']; $mid = $anz['maxi']; $seiten = ($max / $show) +1; mysql_free_result($result_a); echo "<table class='book' summary='gaestebuch'><tr><td>" . $max . " Einträge auf " . (int)$seiten . " Seiten</td><td>Seite "; while ($i <= $seiten) { echo "<a href='index.php?side=book&id=" . $mid . "&t=" . $zahl . "'>". $i . "</a> | "; $result_b = mysql_query("select id from book where id <=" . $mid . " order by id desc LIMIT " . $show); while ($sid = mysql_fetch_array($result_b)) { $sarray[$i] = $sid['id']; } $mid = min($sarray)-1; mysql_free_result($result_b); $zahl = $zahl + $show; $i++; } echo "</td></tr></table><table class='book' summary='einträge'>"; $i=0; $result = mysql_query("select id,von,mail,hp,text, DATE_FORMAT(am,'%d.%m.%Y') as datum from book where id <=" . $id . " order by id desc LIMIT " . $show); while($liste = mysql_fetch_array($result)) { $text = str_replace( array('ä', 'ö', 'ü', 'ß'), array('ä', 'ö', 'ü', 'ß'), $liste['text'] ); $text = nl2br($text); $wert = $max - $i - $it; echo "<tr class=\"gbhead\">"; echo "<th style='width:400px;'><a href='mailto:" . $liste['mail'] . "'>" . $liste['von'] . "</a> schrieb am " . $liste['datum'] ."</th>"; echo "<td>Eintrag Nr: " . $wert . "</td></tr><tr>"; echo "<td colspan='2'>" . $text . "</td></tr><tr><td></td></tr>"; if ($liste['hp'] != "") { echo "<tr><td colspan='2'>Homepage: <a href='" . $liste['hp'] . "' target='_blank'>" . $liste['hp'] . "</a></td></tr>"; } echo "<tr><td><br/><br/></td></tr>"; $i++; } mysql_free_result($result); db_disconnect(); ?>[/CODE] hoffe es kann einer sagen was ich falsch mache mfg Momo [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ★ = 12, ◇ = 4 und die Hälfte von ★ zu ◇ addiert wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
php gästebuch tut komm nicht weiter
Oben