Public feed #604062

Gstebuch

public php v1 · immutable
Raw Edit
·published 2007-07-05 08:45 UTC
rendered paste body
<?php	include ("header.html");	echo "<h1>Gästebuch</h1>	<p><b>Einträge müssen zuerst vom Webmaster freigeschaltet werden!</b></p>";    function bb_decode($data) {        $data = htmlspecialchars($data);        $offset = 0;        while(($pos = strpos($data, '[noparse]', $offset)) !== false) {            $end = strpos($data, '[/noparse]', $pos);            if($end === false) break;            $noparse = substr($data, $pos + 9, $end - ($pos + 9));            $noparse = str_replace(array('[', ']'), array('[', ']'), $noparse);            $end += 10;            $data = substr_replace($data, $noparse, $pos, $end - $pos);            $offset = $end;        }        $search[] = '[b]';        $search[] = '[/b]';        $search[] = '[i]';        $search[] = '[/i]';        $search[] = '[u]';        $search[] = '[/u]';        $search[] = '[/color]';        $search[] = '[/size]';        $search[] = '[/font]';        $search[] = '[highlight]';        $search[] = '[/highlight]';        $replace[] = '<strong>';        $replace[] = '</strong>';        $replace[] = '<i>';        $replace[] = '</i>';        $replace[] = '<u>';        $replace[] = '</u>';        $replace[] = '</font>';        $replace[] = '</font>';        $replace[] = '</font>';        $replace[] = '<span class="highlight">';        $replace[] = '</span>';        $data = str_replace($search, $replace, $data);        $search = array();        $replace = array();        $search[] = '/\[color=(.*?)\]/';        $search[] = '/\[size=(.*?)\]/';        $search[] = '/\[font=(.*?)\]/';        $search[] = '/\[email\](.*?)\[\/email\]/';        $search[] = '/\[email=(.*?)\](.*?)\[\/email\]/';        $search[] = '/\[url\](.*?)\[\/url\]/';        $search[] = '/\[url=(.*?)\](.*?)\[\/url\]/';        $search[] = '/\[img\](.*?)\[\/img\]/';        $replace[] = '<font color="${1}">';        $replace[] = '<font size="${1}">';        $replace[] = '<font face="${1}">';        $replace[] = '<a href="mailto:${1}">${1}</a>';        $replace[] = '<a href="mailto:${1}">${2}</a>';        $replace[] = '<a href="${1}">${1}</a>';        $replace[] = '<a href="${1}">${2}</a>';        $replace[] = '<img src="${1}">';        $data = preg_replace($search, $replace, $data);        $offset = 0;        while(strpos($data, '[list]', $offset) !== false) {            $pos = strpos($data, '[list]', $offset);            $end = strpos($data, '[/list]', $pos);            if($end === false) break;            $list = trim(substr($data, $pos + 6, $end - ($pos + 6)));            $elements = explode('[*]', $list);            $list = '<ul>';            for($i = 1; $i < count($elements); $i++) {                $list .= '<li>'.nl2br(rtrim($elements[$i])).'</li>';            }            $list .= '</ul>';            $end += 7;            $offset = $end;            $data = substr_replace($data, $list, $pos, $end - $pos);        }        $offset = 0;        while(strpos($data, '[list=', $offset) !== false) {            $pos = strpos($data, '[list=', $offset);            $pos2 = strpos($data, ']', $pos + 6);            $type = substr($data, $pos + 6, $pos2 - ($pos + 6));            $end = strpos($data, '[/list]', $pos2);            if($end === false) break;            $list = trim(substr($data, $pos2 + 1, $end - ($pos2 + 1)));            $elements = explode('[*]', $list);            $list = '<ol type="'.$type.'">';            for($i = 1; $i < count($elements); $i++) {                $list .= '<li>'.nl2br(rtrim($elements[$i])).'</li>';            }            $list .= '</ol>';            $end += 7;            $offset = $end;            $data = substr_replace($data, $list, $pos, $end - $pos);        }        $data = nl2br($data);        $offset = 0;        while(($pos = strpos($data, '[code]', $offset)) !== false) {            $end = strpos($data, '[/code]', $pos);            if($end === false) break;            $code = substr($data, $pos + 6, $end - ($pos + 6));            $strlen = strlen($code) + 13;            $code = '<pre>'.str_replace('', '', $code).'</pre>';            $end += 7;            $offset = $end - ($strlen - strlen($code));            $data = substr_replace($data, $code, $pos, $end - $pos);        }        return $data;    }  //BB Code In HTML umwandeln$text = bb_decode($text);//Smiley Code in HTML umwandeln$text = str_replace(":)", '<img src="skype_grinsen.gif" alt=":)">', $text);$text = str_replace(":(", '<img src="skype_traurig.gif" alt=":(" >', $text);$text = str_replace(":angry:", '<img src="skype_boese.gif" alt=":angry:" >', $text);$text = str_replace(":D", '<img src="skype_breites_grinsen.gif" alt=":D" >', $text);$text = str_replace("8)", '<img src="skype_cool.gif" alt="8)">', $text);$text = str_replace(":smoker:", '<img src="skype_smoking.gif" alt="smoker">', $text);$text = str_replace(":|", '<img src="skype_sprachlos.gif" alt=":|">', $text);$text = str_replace("|o-X", '<img src="skype_headbang.gif" alt="headbang">', $text);$text = str_replace(":XD:", '<img src="skype_hihi.gif" alt="hihi">', $text);$text = str_replace(":inot:", '<img src="skype_ich_wars_nicht.gif" alt="inot">', $text);$text = str_replace(":o", '<img src="skype_ueberrrascht.gif" alt="what">', $text);$text = str_replace(":weinen:", '<img src="skype_weinen.gif" alt="weinen">', $text);$text = str_replace("tmi", '<img src="tmi.gif" alt="tmi">', $text);//HTML Codes verhindern$_POST = str_replace("<", "&lt;", $_POST);$_POST = str_replace(">", "&gt;", $_POST);// $mail_to, $subject, $message, $headers$datum = getdate();$name = $_POST['name'];$mail = $_POST['mail'];$mailw = $_POST['mail'];$text = $_POST['text'];$www = $_POST['www'];$action = $_GET['action'];$Submit = $_POST['Submit'];$name = $_POST['name'];//if ($_POST['mail_in_eintrag'] == false) $mail = ""; Nich mehr nötigif ($Submit != ""){$text = str_replace("\n", "<br>", $text);if ($name == "" || $text == ""){echo "<b>Du hast nicht alle Felder ausgef&uuml;llt!</b><br>";echo "<a href=\"javascript:history.back()\">Zur&uuml;ck</a><br>";}else{if ($www == "" AND $mail == ""){$eintrag = "<table style=\"width: 97%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">  <tbody>    <tr>      <td style=\"width: 70%; text-align: left; background-color: #366fc2;\"><b>$name</b></td>            <td style=\"width: 30%; text-align: center; background-color: #366fc2;\">$datum[mday].$datum[mon].$datum[year] | $datum[hours]:$datum[minutes]</td>    </tr>    <tr>      <td style=\"background-color: rgb(234, 234, 234);\" colspan=\"3\" align=\"left\" bgcolor=\"#ffffff\">$text</td>    </tr>  </tbody></table><br>";}elseif ($mail == "" AND $www != "") {$eintrag = "<table style=\"width: 97%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">  <tbody>    <tr>      <td style=\"width: 55%; text-align: left; background-color: #366fc2;\"><b>$name</b></td>      <td style=\"width: 15%; text-align: center; background-color: #366fc2;\"><a href=\"http://$www\"><img style=\"border: 0px solid ; width: 16px; height: 16px;\" alt=\"Homepage\" src=\"homepagexp.gif\"></a>	              <td style=\"width: 30%; text-align: center; background-color: #366fc2;\">$datum[mday].$datum[mon].$datum[year] | $datum[hours]:$datum[minutes]</td>    </tr>    <tr>      <td style=\"background-color: rgb(234, 234, 234);\" colspan=\"3\" align=\"left\" bgcolor=\"#ffffff\">$text</td>    </tr>  </tbody></table><br>";}elseif ($www == "" AND $mail != ""){$eintrag = "<table style=\"width: 97%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">  <tbody>    <tr>      <td style=\"width: 55%; text-align: left; background-color: #366fc2;\"><b>$name</b></td>      <td style=\"width: 15%; text-align: center; background-color: #366fc2;\">	  <a href=\"mailto:$mail\"><img style=\"border: 0px solid ; width: 16px; height: 16px;\" alt=\"Homepage\" src=\"emailline.gif\"></a></td>            <td style=\"width: 30%; text-align: center; background-color: #366fc2;\">$datum[mday].$datum[mon].$datum[year] | $datum[hours]:$datum[minutes]</td>    </tr>    <tr>      <td style=\"background-color: rgb(234, 234, 234);\" colspan=\"3\" align=\"left\" bgcolor=\"#ffffff\">$text</td>    </tr>  </tbody></table><br>";}else{$eintrag = "<table style=\"width: 97%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">  <tbody>    <tr>      <td style=\"width: 55%; text-align: left; background-color: #366fc2;\"><b>$name</b></td>      <td style=\"width: 15%; text-align: center; background-color: #366fc2;\"><a href=\"http://$www\"><img style=\"border: 0px solid ; width: 16px; height: 16px;\" alt=\"Homepage\" src=\"homepagexp.gif\"></a>	  <a href=\"mailto:$mail\"><img style=\"border: 0px solid ; width: 16px; height: 16px;\" alt=\"Homepage\" src=\"emailline.gif\"></a></td>            <td style=\"width: 30%; text-align: center; background-color: #366fc2;\">$datum[mday].$datum[mon].$datum[year] | $datum[hours]:$datum[minutes]</td>    </tr>    <tr>      <td style=\"background-color: rgb(234, 234, 234);\" colspan=\"3\" align=\"left\" bgcolor=\"#ffffff\">$text</td>    </tr>  </tbody></table><br>";}$gb = join("",@file('gaestebuch.txt'));/*$eintrag = $eintrag . $gb;$datei =  fopen("gaestebuch.txt","w+"); fputs($datei,$eintrag); fclose($datei); (Ehem. Entragsprozedur) */$zufall = rand(1,1000000000); //Hehe, das errät so schnell keiner (Da sind 6 Richtige im Lotto warscheinlicher)$datei =  fopen("confirm/" . $zufall . ".txt","w+");fputs($datei,$eintrag);fclose($datei);$Nachricht = "Hallo!Ein neuer Eintrag will gerne überprüft werdenName:	$nameE-Mail:	$mailHP:		$wwwText:$text~~~~~~~~~~~~~~~~~~~~~~~~~Eintrag zulassen: http://meugster.net/Gaestebuch.php?action=confirm&id=$zufallEintrag ablehnen: http://meugster.net/Gaestebuch.php?action=remove&id=$zufallmit freundlichen Grüssen,Michael Eugster";mail("admin@meugster.net", "Neuer GB Eintrag auf meugster.net", $Nachricht, "From: meugster.net <admin@meugster.net>");echo "<font size=\"4\">G&auml;stebuch</font><br />Vielen Dank f&uuml;r deinen Eintrag, <b><i>$name</i></b>.<br><br>Der Admin wird deinen Eintrag &Uuml;berpr&uuml;fen und dann freischalten<br /><br />\n";include("gaestebuch.txt");}}elseif($action=="confirm") {$gb = join("",@file('gaestebuch.txt'));$eintrag = @join("",@file("confirm/" . $_GET['id'] . ".txt"));$erfolg = @unlink("confirm/" . $_GET['id'] . ".txt");$eintrag = $eintrag . $gb;$datei =  fopen("gaestebuch.txt","w+");fputs($datei,$eintrag);fclose($datei);if ($erfolg == true) {	echo "<font size=\"4\">G&auml;stebuch</font><br />Dein Eintrag wurde hinzugefügt<br />";}else {	echo "<font size=\"4\">G&auml;stebuch</font><br />Dein Eintrag wurde nicht hinzugefügt<br />Vielleicht hast du den Hinzufügenlink schon einmal benutzt ;)";}include("gaestebuch.txt");}elseif($action=="remove") {@unlink("confirm/" . $_GET['id'] . ".txt");echo "<br />Eintrag gel&ouml;scht<br />";include("gaestebuch.txt");}elseif($action=="eintragen"){?><p><font size="2" style="font-weight:bold">Der Webmaster behält sich vor, Einträge zu entfernen, bzw. zu ändern!</font></p><form action="" method="post"> <br><table border="0" cellspacing="2"><tbody><tr>    <td><div align="right">Dein Name:</div></td>    <td>&nbsp;</td>    <td><input name="name" class="w1" size="24" type="text"></td>  </tr>  <tr>    <td><div align="right">Homepage:</div></td>    <td>http://</td>    <td><input name="www" class="w1" size="24" type="text"></td>  </tr>  <tr>    <td><div align="right">E-Mailadresse:</div></td>    <td>&nbsp;</td>    <td><input name="mail" class="w1" size="24" type="text"><!--      &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="mail_in_eintrag" value="checkbox" id="checkbox">      <label for="checkbox">E-Mailadresse auch in Gästebucheintrag anzeigen</label>--></td>  </tr>  <tr>    <td>Dein Eintrag:</td>	<td>&nbsp;</td>	<td>  <textarea id="text" name="text" class="w1"></textarea></td>    <tr>  <td>&nbsp;</td>  <td>&nbsp;</td>  <td>  <input type="submit" name="Submit" value="Eintragen" class="button">  </td>  </tr></tbody></table><p><br><br>Smileys: <img src="skype_grinsen.gif" alt="smile" onclick="document.getElementById('text').value += ':)'"><noscript>:)</noscript><img src="skype_traurig.gif" alt="sad" onclick="document.getElementById('text').value += ':('"> <noscript>:(</noscript><img src="skype_boese.gif" alt="angry" onclick="document.getElementById('text').value += ':angry:'"> <noscript>:angry:</noscript><img src="skype_breites_grinsen.gif" alt="big grin" onclick="document.getElementById('text').value += ':D'"><noscript>:D</noscript><img src="skype_cool.gif" alt="8)" onclick="document.getElementById('text').value += '8)'"><noscript>8)</noscript><img src="skype_smoking.gif" alt="smoker" onclick="document.getElementById('text').value += ':smoker:'"><noscript>:smoker:</noscript><img src="skype_sprachlos.gif" alt="smoker" onclick="document.getElementById('text').value += ':|'"><noscript>:|</noscript><img src="skype_headbang.gif" alt="headbang" onclick="document.getElementById('text').value += '|o-X'"><noscript>|o-X</noscript><img src="skype_hihi.gif" alt="hihi" onclick="document.getElementById('text').value += ':XD:'"><noscript>:XD:</noscript> <img src="skype_ich_wars_nicht.gif" alt="inot" onclick="document.getElementById('text').value += ':inot:'"><noscript>:inot:</noscript>  <img src="skype_ueberrrascht.gif" alt="what" onclick="document.getElementById('text').value += ':o'"><noscript>:o</noscript>   <img src="skype_weinen.gif" alt="weinen" onclick="document.getElementById('text').value += ':weinen:'"><noscript>:weinen:</noscript>	<img src="tmi.gif" alt="tmi" onclick="document.getElementById('text').value += 'tmi'"><noscript>tmi</noscript>  <br><br><noscript><br><b>Sie haben bei Ihrem Browser JavaScript deaktiviert. Um die Smiles per Mausklick einzufügen, aktivieren Sie JavaScript in Ihren Browser-Einstellungen.<br></b></noscript><b>Hinweis: </b>Es kann von BB Code gebrauch gemacht werden!<br><br><?php}else{?><p><a href="?action=eintragen">G&auml;stebucheintrag hinzufügen.</a><br><br><?phpinclude("gaestebuch.txt");}?><?phpecho "<p><b>Herzlichen Dank an Michael Walser für die grossartige Arbeit an diesem Gästebuch!</b><br><br><br></p>";include ("footer.html");?>