Gästebuch einpassen

ominglow

Mitglied
Hallo again.

Noch ein Problem liegt mir vor.
Ich möchte mein Gästebuch einpassen in ein vorgegebenes Layout.

Problem: das GB ist in PHP. Und ich habe keine Ahnung wie ich es einpassen könnte!?
Infos zum GB:

* my little guestbook
* Copyright (C) 2007 mylittlehomepage.net
* http://mylittlehomepage.net/code_collection


gbbproblemym6.jpg

Shot at 2007-08-09
(Siehe Bild)

mfg. ominglow
 
Hallo bin selber noch Anfänger.

Wenn du nur die Seite ins Webstellen willst is das so i.o. Aber wenn du sie verwalten willst, solltest dich ein wenig auskennnen besondes mit PHP und MYsql wenn du ein GB hast.

Auf Quake.net -> google (qnet eingeben) gibt es dazu ein wunderschönes Tutiorial. Allg. wird dort php und mysql erklärt, zwar anhand einer Clanwar-Seite aber das macht ja nichts.

Das GB anzupassen ist denk ich genauso schwierig wie eins selber zu schreiben ... Aber man weis, was man macht wenn man es selber schreibt.

Achso die Frage wird sowieso kommen ... wie willst du es denn anpassen, was stört dich bzw willst du

Viel Glück MFG

MOE
 
Hallo

Leider habe ich die Zeitlichen-Mittel nicht, um mich in PHP. einzulesen.
Das GB ist im Prinzip sehr einfach zu verwalten, mit Admin Tool. (Löschen, Edit)

Ist es nicht mögliche ein vorgefertigtes GB in ein bestehendes Layout einzupassen?
Sobald man PHP. mit html mischt, wird die Seite leer-weiss angezeigt, soviel weiss ich. ;-)
Also kann ich nur das GB ober dem Layout positionieren oder unter ihm..!?

Gruss ominglow
 
Sicherlich ist es möglich. Es würde jedoch nichts bringen dir es zu erklären wenn du eh keine Zeit hast dich damit zu befassen :-)
 
Du kannst das GB irgend wo einfügen ... z.b.
[
HTML:
<table>
<tr>
<td> <? //Start von PHP und damit vom GB ?>
</td>
<tr>
</table>

So könnte es aussehn wenn du es in eine Table integrierst ... Wichtig ist das die einleitung <? oder <?php vorhanden ist und das ende ?> oder ?php>

Schreib doch mal das Script hier rein wo du es einfügen willst
 
Ja kann ich gerne machen. Das Problem ist, ich weiss nicht wo der PHP. Code genau hinkommt, damit (siehe Bild) das GB genau dort dazwischen zu stehen kommt!?
Ich werde den Code heute Abend gerne hier bereitstellen. Bis dann-danke.

Hier den Code:
Code:
<HTML>
<HEAD>
<TITLE></TITLE>

	<STYLE TYPE="TEXT/CSS">
	BODY     { margin:0; }
	TD       { font-family:verdana,arial; font-size:12px; }
	A        { text-decoration:underline; color:3366CC; }
	A:hover  {

    a:active {
	text-decoration: none;
}
.Stil2 {font-size: 14px}
    .Stil4 {font-size: 14px; font-weight: bold; }
    </STYLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
<BODY>

<TABLE WIDTH=780 align="center" CELLSPACING=0>
<TD BACKGROUND="images/top1a.jpg" HEIGHT=44 VALIGN=BOTTOM>
   <TABLE HEIGHT=26>
   <TD WIDTH=510>
   <TD VALIGN=TOP>
   <FONT SIZE=1 COLOR=CACACA><B>» Bleib am Ball...
   </TABLE>
<TR>
<TD BACKGROUND="images/top2a.jpg" HEIGHT=133 VALIGN=TOP>
   <TABLE CELLPADDING=8>
       <TD>
       
     </TABLE>
   <TR>
<TD>
<BR><BR>

    <TABLE WIDTH=100% CELLPADDING=0>
    <TD WIDTH=160 VALIGN=TOP>
        <TABLE WIDTH=96% ALIGN=CENTER>
        <TD>
        <IMG SRC="images/text-navigation.jpg" WIDTH=116 HEIGHT=13 ALT=Navigation><BR><BR>

            <TABLE CELLSPACING=2 CELLPADDING=0>
	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <a href="index.htm"><FONT SIZE=1> </a>
                <div align="left"><a href="index.htm" class="Stil2">Startseite                 </a></div>
                </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <FONT SIZE=1> <div align="left" class="Stil2">Vorstand
                </div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <FONT SIZE=1> <div align="left" class="Stil2">Tarife</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <span class="Stil2"><FONT SIZE=1> </span>
                <div align="left" class="Stil2">Platz</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <FONT SIZE=1> <div align="left" class="Stil2">Anfahrt</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                    <div align="left" class="Stil2">Mitglieder</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <strong><FONT SIZE=1>                </strong>
                <div align="left" class="Stil4">Kontakt                </div>
                  </TABLE>
	    </TABLE>
        </TABLE>

    <BR>
    
    <TD WIDTH=1 BACKGROUND="images/dot-bg.jpg">
    <TD VALIGN=TOP>
        <TABLE WIDTH=98% ALIGN=CENTER>
        <TD><p><?php 
/******************************************************************************
* my little guestbook                                                         *
* Copyright (C) 2007 mylittlehomepage.net                                     *
* http://mylittlehomepage.net/code_collection                                 *
******************************************************************************/

/******************************************************************************
* This program is free software; you can redistribute it and/or               *
* modify it under the terms of the GNU General Public License                 *
* as published by the Free Software Foundation; either version 2              *
* of the License, or (at your option) any later version.                      *
*                                                                             *
* This program is distributed in the hope that it will be useful,             *
* but WITHOUT ANY WARRANTY; without even the implied warranty of              *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                *
* GNU General Public License for more details.                                *
*                                                                             *
* You should have received a copy of the GNU General Public License           *
* along with this program; if not, write to the Free Software                 *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. *
******************************************************************************/

// Settings:

// Name of guestbook:
$guestbook_title = 'Guestbook';

// Administration password:
$password = 'admin';

// File in which the entries will be saved (requires CHMOD 666):
$gbdata = "guestbook.dat";

// How many entries per page?
$entries_per_page = 10;

// Admin E-mail for notifications (optional):
$adminemail = '';

// BB-Codes on?
$bbcode = false;

/// Make links clickable:
$autolink = true;

// If you want to use smilies specify the smiley folder e.g. "img/" (where these 
// images are: smile.gif, wink.gif, biggrin.gif, tongue.gif, neutral.gif, frown.gif):
$smiley_folder = '';

// Time format:
$time_format = "%B %d, %Y, %H:%M";

// Length limitations:
$name_maxlength = 40;
$name_word_maxlength = 25;
$email_maxlength = 40;
$hp_maxlength = 40;
$place_maxlength = 40;
$place_word_maxlength = 25;
$text_maxlength = 3000;
$text_minlength = 5;
$text_word_maxlength = 50;

// Paths to images for Homepage and E-Mail links (optional):
$homepage_icon = "";
$email_icon = "";

// Language settings:
$locale =                    array("en", "en_EN@euro", "eng");
$new_entry =                 "New entry";
$back =                      "Back";
$preview_marking =           "Preview";
$error_marking =             "Error:";
$optional_marking =          "(optional)";
$name_marking =              "Name:";
$email_marking =             "E-mail:";
$hp_marking =                "Homepage:";
$place_marking =             "Location:";
$comment_marking =           "Comment:";
$password_marking =          "Password:";
$password_wrong_marking =    "Password wrong!";
$submit_button =             "OK - Submit";
$preview_button =            "Preview";
$bbcode_exp =                "Text can be formatet with these codes: [ b]text[ /b] for <b>bold</b> text, [ i]text[/ i] for <i>italic</i> text.<br />To insert links: [link]http://www.domain.de/[/link] or [link=http://www.domain.de/]Link[/link]";
$error_no_name =             "No name entered";
$error_no_text =             "No message entered";
$error_email_wrong =         "E-mail address seems to be invalid";
$error_text_too_long =       "The message is too long ([characters] characters) - you can only enter up to [max_characters] characters";
$error_text_too_short =      "Your message is too short";
$error_word_too_long =       "The word \"[word]\" is long";
$error_already_made_entry =  "You already made an entry in the last 5 minutes, try again later";
$error_spam =                "Spam protection check failed";
$spam_check =                'Spam protection check:';
$delete_entry_marking =      "Delete entry:";
$delete_entry_conf_marking = "Are you sure that you want to delete the entry by <b>[name]</b>?";
$no_authorisation_marking =  "No authorisation, please log in.";
$log_in_marking =            "log in";
$edit_button =               "edit";
$delete_button =             "delete";
$delete_conf_button =        "OK - Delete";
$previous_page =             "Previous page";
$next_page =                 "Next page";
$still_no_entries_marking =  "No entries yet.";
$mail_subject =              "New entry in guestbook";
$hp_link_marking =           "Homepage";
$email_link_marking =        "E-mail";

// End of settings

##############################################################################

session_start();

function bbcode($string)
 {
  $string = preg_replace("#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $string);
  $string = preg_replace("#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $string);
  $string = preg_replace("#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $string);
  $string = preg_replace("#\[link\]www\.(.+?)\[/link\]#is", "<a href=\"http://www.\\1\">www.\\1</a>", $string);
  $string = preg_replace("#\[link\](.+?)\[/link\]#is", "<a href=\"\\1\">\\1</a>", $string);
  $string = preg_replace("#\[link=(.+?)\](.+?)\[/link\]#is", "<a href=\"\\1\">\\2</a>", $string);
  $string = preg_replace("#\[url\]www\.(.+?)\[/url\]#is", "<a href=\"http://www.\\1\">www.\\1</a>", $string);
  $string = preg_replace("#\[url\](.+?)\[/url\]#is", "<a href=\"\\1\">\\1</a>", $string);
  $string = preg_replace("#\[url=(.+?)\](.+?)\[/url\]#is", "<a href=\"\\1\">\\2</a>", $string);
  return $string;
 }

function smilies($string)
 {
  global $smiley_folder;
  $string = str_replace(":-)", "<img src=\"".$smiley_folder."smile.gif\" alt=\":-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("(-:", "<img src=\"".$smiley_folder."smile.gif\" alt=\":-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":)", "<img src=\"".$smiley_folder."smile.gif\" alt=\":)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("(:", "<img src=\"".$smiley_folder."smile.gif\" alt=\":)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(";-)", "<img src=\"".$smiley_folder."wink.gif\" alt=\";-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(";)", "<img src=\"".$smiley_folder."wink.gif\" alt=\";-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-D", "<img src=\"".$smiley_folder."biggrin.gif\" alt=\":-D\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":D", "<img src=\"".$smiley_folder."biggrin.gif\" alt=\":D\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-P", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-P\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-p", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":p", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":P", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-|", "<img src=\"".$smiley_folder."neutral.gif\" alt=\":-|\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":|", "<img src=\"".$smiley_folder."neutral.gif\" alt=\":|\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-(", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":(", "<img src=\"".$smiley_folder."frown.gif\" alt=\":(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(")-:", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("):", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  return $string;
 }

function make_link($string)
 {
  $string = ' ' . $string;
  $string = preg_replace("#(^|[\n ])([\w]+?://.*?[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\">\\2</a>", $string);
  $string = preg_replace("#(^|[\n ])((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^ \"\t\n\r<]*)?)#is", "\\1<a href=\"http://\\2\">\\2</a>", $string);
  $string = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $string);
  $string = substr($string, 1);
  return $string;
 }

function browse()
 {
  global $p, $entries_per_page, $entry_count, $previous_page, $next_page;

  if ($entry_count > $entries_per_page)
  {
   $new_index_before = $p - 1;
   $new_index_after = $p + 1;
   $site_count = ceil($entry_count / $entries_per_page);
   ?><p class="gb-browse"><?php
   if ($new_index_before >= 0) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_before; ?>" title="<?php echo $previous_page; ?>">&laquo;</a>&nbsp;<?php }
   if ($new_index_before >= 0 && $new_index_before < $site_count) echo "";
   if ($p==0) { ?><span class="caution">1</span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=0">1</a>&nbsp;<?php }
   for($x=$p-3; $x<$p+4; $x++)
    {
     if ($x > 0 && $x < $site_count) { if ($x==$p) { ?><span class="caution"><?php echo $x+1; ?></span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $x; ?>"><?php echo $x+1; ?></a>&nbsp;<?php } }
    }
   if ($new_index_after < $site_count) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_after; ?>" title="<?php echo $next_page; ?>">&raquo;</a><?php }
   ?></p><?php
  }
 }

if (isset($_POST['action'])) $action = $_POST['action'];
if (isset($_GET['action'])) $action = $_GET['action'];

if (isset($_POST['login_password']))
 {
  if ($_POST['login_password'] == $password)
   {
    $_SESSION['admin'] = true;
    header("location: ".basename($_SERVER["PHP_SELF"]));
    die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
   }
  else { $action="none"; $show="login failed"; }
 }

if (isset($_POST['edit']))
 {
  if (isset($_SESSION['admin']))
   {
    $data = file($gbdata);
    $row_count = count($data);
    for ($row = 0; $row < $row_count; $row++)
     {
      $parts = explode("|", $data[$row]);
      if ($parts[0] == $_POST['entry_uniqid'])
       {
        $entry_uniqid = $parts[0];
        $time = $parts[1];
        $ip = $parts[2];
        $name = urldecode($parts[3]);
        $email = base64_decode(urldecode($parts[4]));
        $hp = urldecode($parts[5]);
        $place = urldecode($parts[6]);
        $text = urldecode($parts[7]);
        $comment = urldecode($parts[8]);
        break;
       }
     }
    $action="edit";
    $show="form";
   }
  else { $action = "none"; $show = "no authorization"; }
 }

// Eintrag löschen:
if (isset($_POST['delete']) && isset($_POST['entry_uniqid']))
 {
  if (isset($_SESSION['admin']))
   {
    $data = file($gbdata);
    $row_count = count($data);
    $fp = fopen($gbdata, 'w+');
    flock($fp, 2);
    for ($row = 0; $row < $row_count; $row++)
     {
      $parts = explode("|", $data[$row]);
      if ($parts[0] != $_POST['entry_uniqid']) { fwrite($fp, trim($data[$row])."\n"); }
     }
    flock($fp, 3);
    fclose($fp);

    header("location: ".basename($_SERVER["PHP_SELF"]));
    die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
   }
  else { $action = "none"; $show = "no authorization"; }
 }

// wenn Formular abgeschickt wurde:
if (isset($_POST['form_submited']))
{
 // &uuml;bergebene Variablen ermitteln:
 if (isset($_POST['time'])) $time = $_POST['time'];
 if (isset($_POST['entry_uniqid'])) $entry_uniqid = $_POST['entry_uniqid'];
 $name = $_POST['name'];
 $text = $_POST['text'];
 $place = $_POST['place'];
 $email = $_POST['email'];
 $hp = $_POST['hp'];
 if (isset($_POST['comment'])) $comment = $_POST['comment']; else $comment="xxx";
 // unn&ouml;tige Leerzeichen abschneiden:
 $name = trim($name);
 $email = trim($email);
 $hp = trim($hp);
 $place = trim($place);
 $text = trim($text);
 $comment = trim($comment);
 if ($comment=="") $comment="xxx";
 // "http://" von Homepage abschneiden:
 if (substr($hp,0,7) == "http://") { $hp = substr($hp,7); }
 // &Uuml;berpr&uuml;fungen der Daten:
 unset($errors);

 // Ckeck if IP already posted in the last 5 minutes:
 $data = file($gbdata);
 foreach($data as $line)
  {
   if (trim($line)!="")
   {
   $parts = explode("|", $line);
   $saved_time = (int)$parts[1];
   if (time() < $saved_time+300 && $_SERVER["REMOTE_ADDR"] == $parts[2] && !isset($_SESSION['admin']))
    {
     $errors[] = $error_already_made_entry; break;
    }
   }
  }

 if ($name == "") $errors[] = $error_no_name;
 if ($text == "") $errors[] = $error_no_text;
 if(isset($email) && $email != "" and !preg_match("/^[^@]+@.+\.\D{2,5}$/", $email)) $errors[] = $error_email_wrong;
 if (strlen($text) > $text_maxlength) { $error_text_too_long = str_replace("[characters]", strlen($text), $error_text_too_long); $error_text_too_long = str_replace("[max_characters]", $text_maxlength, $error_text_too_long); $errors[] = $error_text_too_long; }
 if ($text != "" && strlen($text) < $text_minlength) $errors[] = $error_text_too_short;
 // Schauen, ob zu lange Wörter vorhanden sind:
 $text_arr = explode(" ",$name); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $name_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$name_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }
 $text_arr = explode(" ",$place); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $place_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$place_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }
 $text_arr = str_replace("\n", " ", $text);
 if ($bbcode == true); { $text_arr = preg_replace("#\[b\](.+?)\[/b\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[i\](.+?)\[/i\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[u\](.+?)\[/u\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[link\](.+?)\[/link\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[link=(.+?)\](.+?)\[/link\]#is", "\\2", $text_arr); }
 $text_arr = explode(" ",$text_arr); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $text_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$text_word_maxlength)))."...", $error_word_too_long);$errors[] = $error_word_too_long_x; } }

  if(isset($_POST['entry']) && $action!='edit')
   {
    $z1 = intval($_POST["z1"]);
    $z2 = intval($_POST["z2"]);
    $gerechnet = intval($_POST["gerechnet"]);
    $rechencheck = $z1 + $z2;
    if ($gerechnet != $rechencheck || empty($gerechnet) || empty($rechencheck))
    $errors[] = $error_spam;
   } 

 // save entry when no errors:
 if (empty($errors) && isset($_POST['entry']) && $action=="entry")
  {
   $time = time();
   $text = urlencode($text);
   $name = urlencode($name);
   $email = urlencode(base64_encode($email));
   $hp = urlencode($hp);
   $place = urlencode($place);
   $ip = $_SERVER["REMOTE_ADDR"];
   $comment = urlencode($comment);
   $entry = uniqid("")."|".$time."|".$ip."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n";
   $data = file($gbdata);
   $c = count($data);
   $fp = fopen($gbdata, 'w+');
   flock($fp, 2);
   fwrite($fp, $entry);
   for ($i = 0; $i < $c; $i++) { fwrite($fp, trim($data[$i])."\n"); }
   flock($fp, 3);
   fclose($fp);

   // e-mail notification:
   if (isset($adminemail) && $adminemail != "")
   {
    $emailbody = urldecode($text);
    $absender = urldecode($name);
    if ($email != "") $absender_email = base64_decode(urldecode($email)); else $absender_email = "no@ema.il";
    $header= "From: ".$absender."<".$absender_email.">\n";    $header .= "X-Mailer: PHP/" . phpversion(). "\n";
    $header .= "X-Sender-IP: ".$_SERVER['REMOTE_ADDR']."\n";
    $header .= "Content-Type: text/plain";
    @mail($adminemail, $mail_subject, $emailbody, $header);
   }
   header("location: ".basename($_SERVER["PHP_SELF"]));
   die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
  }

 elseif (empty($errors) && isset($_POST['entry']) && $action=="edit")
  {
   if(isset($_SESSION['admin']))
    {
     $entry_uniqid = $_POST['entry_uniqid'];
     $name = urlencode($name);
     $email = urlencode(base64_encode($email));
     $hp = urlencode($hp);
     $place = urlencode($place);
     $text = urlencode($text);
     $comment = urlencode($comment);
     $data = file($gbdata);
     $row_count = count($data);
     $fp = fopen($gbdata, "w+");
     flock($fp, 2);
     for ($row = 0; $row < $row_count; $row++)
      {
       $parts = explode("|", $data[$row]);
       if ($parts[0] == $entry_uniqid) { fwrite($fp, $parts[0]."|".$parts[1]."|".$parts[2]."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n"); }
       else { fwrite($fp, trim($data[$row])."\n"); }
      }
     flock($fp, 3);
     fclose($fp);
     header("location: ".basename($_SERVER["PHP_SELF"]));
     die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
    }
   else $show="no authorization";
  }
 else $show="form";
}

if (empty($action)) $action="main";

switch ($action)
 {
  case "main":
   if (isset($_GET['p'])) $p = $_GET['p'];
   $data = file($gbdata);
   $entry_count = count($data);
   if (empty($p)) $p = 0;
   $last = ($p+1) * $entries_per_page;
   if ($last > $entry_count) $last = $entry_count;
   $show="main";
  break;
  case "entry":
   $show="form";
  break;
  case "login":
   if (isset($_SESSION['admin'])) { session_destroy(); header("location: ".basename($_SERVER["PHP_SELF"])); die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>"); }
   else $show="login form";
  break;
 }

setlocale(LC_ALL, $locale);



################################################################################
// Begin HTML
// Here you could include a header --> include("header.html");
################################################################################
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $guestbook_title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body                { font-family: Verdana,Arial,Helvetica,sans-serif; color: #000000; font-size:13px; background-color: #fffff3; margin: 0px; padding: 20px; }
h1                  { margin: 0px 0px 20px 0px; font-size:18px; font-weight:bold; }
div.gb              { margin: 0px 0px 20px 0px; padding: 0px; border: 1px solid #ffcc00; line-height: 19px; }
div.gb-author       { margin: 0px; padding: 1px 10px 1px 10px; border-bottom: 1px solid #ffcc00; background: #ffffcc; }
p.gb-author-left    { margin: 0px; float: left; }
p.gb-author-right   { margin: 0px; text-align: right; }
div.gb-entry        { margin: 10px; padding: 0px; }
p.gb-browse         { text-align: right; font-weight: bold; }
p.gb-admin-buttons  { margin: 5px 0px 0px 0px; text-align: right; }
.caution            { color: red; font-weight: bold; }
.small              { font-size: 11px; line-height:16px; }
.comment            { margin: 10px 0px 0px 0px; color: #808080; font-style: italic; }
img                 { border: 0px; }
a:link              { color: #0000cc; text-decoration: none; }
a:visited           { color: #0000cc; text-decoration: none; }
a:hover             { color: #0000ff; text-decoration: underline; }
a:active            { color: #ff0000; text-decoration: none; }
-->
</style>

     </p>
     <p class="gb-author-right">
     <?php
     if ($place != "") { echo htmlspecialchars(stripslashes($place)) . ",&nbsp;"; }
     if ($action=="edit") { echo strftime($time_format, $_POST['time']); } else echo strftime($time_format);
     ?></p></div>
     <div class="gb-entry"><?php echo $pr_text; ?>
     <?php if (substr($pr_comment,0,3)!="xxx") { ?><p class="comment"><?php echo $pr_comment; ?></span></p><?php } ?>
     </div>
     </div><br />
     <?php
    }
   ?><form method="post" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><div>
   <input type="hidden" name="form_submited" value="true" />
   <input type="hidden" name="action" value="<?php echo $action; ?>" />
   <?php if ($action=="edit") { ?><input type="hidden" name="entry_uniqid" value="<?php echo $entry_uniqid; ?>" /><input type="hidden" name="time" value="<?php echo $time; ?>" /><?php } ?>
   <table class="normal" border="0" cellpadding="3" cellspacing="0">
    <tr>
     <td><b><?php echo $name_marking; ?></b></td>
     <td><input type="text" name="name" value="<?php if (isset($name)) echo htmlspecialchars(stripslashes($name)); else echo ""; ?>" size="40" maxlength="<?php echo $name_maxlength; ?>" /></td>
    </tr>
    <tr>
     <td><b><?php echo $email_marking; ?></b></td>
     <td><input type="text" name="email" value="<?php if (isset($email)) echo htmlspecialchars(stripslashes($email)); else echo ""; ?>" size="40" maxlength="<?php echo $email_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td><b><?php echo $hp_marking; ?></b></td>
     <td><input type="text" name="hp" value="<?php if (isset($hp)) echo htmlspecialchars(stripslashes($hp)); else echo ""; ?>" size="40" maxlength="<?php echo $hp_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td><b><?php echo $place_marking; ?></b></td>
     <td><input type="text" name="place" value="<?php if (isset($place)) echo htmlspecialchars(stripslashes($place)); else echo ""; ?>" size="40" maxlength="<?php echo $place_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td colspan="2"><br /><textarea name="text" cols="59" rows="13"><?php if (isset($text)) echo htmlspecialchars(stripslashes($text)); else echo ""; ?></textarea></td>
    </tr><?php
    if($action!='edit')
    { ?><tr>
      <td colspan="2">
        <?php
          srand((double)microtime() * 1000000);
          $zahl1 = rand(1, 50);
          $zahl2 = rand(1, 9); 
          ?><input type="hidden" name="z1" value="<?php echo $zahl1; ?>" />
          <input type="hidden" name="z2" value="<?php echo $zahl2 ?>" />
          <?php echo $spam_check; ?> <?php echo $zahl1; ?> + <?php echo $zahl2; ?> = <input type="text" name="gerechnet" size="2" maxlength="2" />
      </td>
    </tr><?php
    }
    if ($action=='edit') 
    {
    ?><tr>
     <td colspan="2"><b><?php echo $comment_marking; ?></b><br /><textarea name="comment" cols="59" rows="5"><?php if (isset($comment) && substr($comment,0,3)!="xxx") echo htmlspecialchars(stripslashes($comment)); ?></textarea></td>
    </tr>
    <?php } ?>
    <tr>
     <td colspan="2"><br /><input type="submit" name="entry" value="<?php echo $submit_button; ?>" />&nbsp;<input type="submit" name="preview" value="<?php echo $preview_button; ?>" /></td>
     <td>&nbsp;</td>
    </tr>
   </table>
   </div></form>
   <?php if ($bbcode==true) { ?><p class="small"><br /><?php echo $bbcode_exp; ?></p><?php }

  break;

  case "login form":
   ?>
   <form action="<?php echo basename($_SERVER["PHP_SELF"]); ?>" method="post">
   <p><b><?php echo $password_marking; ?></b><br /><input type="password" name="login_password" />&nbsp;<input type="submit" value="<?php echo $log_in_marking; ?>" /></p>
   </form>
   <?php
  break;

  case "login failed":
   ?><p class="caution"><?php echo $password_wrong_marking; ?></p><?php
  break;

  case "no authorization":
   ?><p class="caution"><?php echo $no_authorisation_marking; ?></p><p>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=login"><?php echo $log_in_marking; ?></a> ]</p><?php
  break;
 }

################################################################################
// End of HTML
// Here you could include a footer --> include("footer.html");
################################################################################

?><p class="small" style="text-align: right;"><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=login">Admin-Login</a> | powered by <a href="http://mylittlehomepage.net/code_collection">my little guestbook</a></p>
</body>
</html>

&nbsp;</p>
            </TABLE>

    <BR>
    </TABLE>

    <BR>
<BR>
<TR>
<TD BACKGROUND="images/bottom.jpg" HEIGHT=70>



<BR>
<BR>
</TABLE>


</BODY>
</HTML></HTML>

Habe bissel was rausgeschnitten, da es mehr als 30000 Zeichen sind :-).
Hier ein Bild wie es mit diesem Code aussieht. --> http://bildupload.sro.at/a/images/BG Problem.jpg


ominglow
 
Zuletzt bearbeitet:
30000? Zeichen und der Server kommt noch damit klar. Egal

So zu deinem Problem. Es sieht so aus als hättest du das falsch eingesetzt. Das GB wird als Text gesehn und nicht als Code. Möglich ist das durch vergessen von zeichen oder einfügen von zeichen.

Schreib doch mal den Code ohne das GB hin. Und makiere die Stelle wo du das BG hinhaben willst z.b. mit nem Kommentar oder so ...

Ich werd es dann einfach einfügen. Ist wohl die beste Idee ;). Kann aber erst morgen um die selbe zeit antworten. Muss arbeiten :(

MFG MOE
 
Hallo Master..
Nun hier den Code ohne GB, ich habe die Stelle rot markiert, wo ich es hinsetzen würde. (gemacht habe, siehe Bild)
Code:
<HTML>
<HEAD>
<TITLE></TITLE>

	<STYLE TYPE="TEXT/CSS">
	BODY     { margin:0; }
	TD       { font-family:verdana,arial; font-size:12px; }
	A        { text-decoration:underline; color:3366CC; }
	A:hover  {
	color:#000000;
	text-decoration: none;
}
	A:link   {
	color:#000000;
	text-decoration: none;
}
	A:visited{
	color:#000000;
	text-decoration: none;
}
    a:active {
	text-decoration: none;
}
.Stil2 {font-size: 14px}
    .Stil4 {font-size: 14px; font-weight: bold; }
    </STYLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
<BODY>

<TABLE WIDTH=780 align="center" CELLSPACING=0>
<TD BACKGROUND="images/top1a.jpg" HEIGHT=44 VALIGN=BOTTOM>
   <TABLE HEIGHT=26>
   <TD WIDTH=510>
   <TD VALIGN=TOP>
   <FONT SIZE=1 COLOR=CACACA><B>» Bleib am Ball...
   </TABLE>
<TR>
<TD BACKGROUND="images/top2a.jpg" HEIGHT=133 VALIGN=TOP>
   <TABLE CELLPADDING=8>
       <TD>
       
     </TABLE>
   <TR>
<TD>
<BR><BR>

    <TABLE WIDTH=100% CELLPADDING=0>
    <TD WIDTH=160 VALIGN=TOP>
        <TABLE WIDTH=96% ALIGN=CENTER>
        <TD>
        <IMG SRC="images/text-navigation.jpg" WIDTH=116 HEIGHT=13 ALT=Navigation><BR><BR>

            <TABLE CELLSPACING=2 CELLPADDING=0>
	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <a href="index.htm"><FONT SIZE=1> </a>
                <div align="left"><a href="index.htm" class="Stil2">Startseite                 </a></div>
                </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <FONT SIZE=1> <div align="left" class="Stil2">Vorstand
                </div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <FONT SIZE=1> <div align="left" class="Stil2">Tarife</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <span class="Stil2"><FONT SIZE=1> </span>
                <div align="left" class="Stil2">Platz</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <FONT SIZE=1> <div align="left" class="Stil2">Anfahrt</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                    <div align="left" class="Stil2">Mitglieder</div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD ALIGN=CENTER background="Ziehen Sie auf eine Datei, um sie zu w&auml;hlen." BGCOLOR=EBEBEB ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <a href="Fotos.htm"><FONT SIZE=1> </a>
                <div align="left" class="Stil2"><a href="Fotos.htm">Fotos</a></div>
                  </TABLE>

	    <TR><TD>
                <TABLE CELLSPACING=1 CELLPADDING=1 WIDTH=110 BGCOLOR=CBCBCB>
                  <TD BGCOLOR=EBEBEB ALIGN=CENTER ONMOUSEOVER="this.bgColor='D4F0FE'" ONMOUSEOUT="this.bgColor='EBEBEB'">
                <strong><FONT SIZE=1>                </strong>
                <div align="left" class="Stil4">Kontakt                </div>
                  </TABLE>
	    </TABLE>
        </TABLE>

    <BR>
    
    <TD WIDTH=1 BACKGROUND="images/dot-bg.jpg">
    <TD VALIGN=TOP>
        <TABLE WIDTH=98% ALIGN=CENTER>
        <TD><p>HIER SCRIPT EINSETZEN&nbsp;</p>
            </TABLE>

    <BR>
    </TABLE>

    <BR>
<BR>
<TR>
<TD BACKGROUND="images/bottom.jpg" HEIGHT=70>



<BR>
<BR>
</TABLE>


</BODY>
</HTML>


Hab Dank für Deine Hilfe.
Gruss ominglow
 
Hallo

Also einfügen war ganz einfach. Aber das guestebuch funkts nicht so richtig beim einfügen.
Habs auch ohne deine Seite gestetest aber es bleiben Fehler
PHP:
Warning: fopen(guestbook.dat) [function.fopen]: failed to open stream: Permission denied in /srv/www/web4/html/guestbook.php on line 330

Warning: flock(): supplied argument is not a valid stream resource in /srv/www/web4/html/guestbook.php on line 331


Warning: flock(): supplied argument is not a valid stream resource in /srv/www/web4/html/guestbook.php on line 334

Warning: fclose(): supplied argument is not a valid stream resource in /srv/www/web4/html/guestbook.php on line 335

Warning: Cannot modify header information - headers already sent by (output started at /srv/www/web4/html/guestbook.php:330) in /srv/www/web4/html/guestbook.php on line 348
further...

Da weis ich dann auch nicht mehr weiter ... vlt funkts ja aber bei dir ich geb dir mal den code ;)

PHP:
    <BR>
    
    <TD WIDTH=1 BACKGROUND="images/dot-bg.jpg">
    <TD VALIGN=TOP>
        <TABLE WIDTH=98% ALIGN=CENTER>
        <TD><p><?php

$guestbook_title = 'Guestbook';


$password = 'admin';

$gbdata = "guestbook.dat";


$entries_per_page = 10;

$adminemail = '';


$bbcode = false;


$autolink = true;


$smiley_folder = '';

$time_format = "%B %d, %Y, %H:%M";

// Length limitations:
$name_maxlength = 40;
$name_word_maxlength = 25;
$email_maxlength = 40;
$hp_maxlength = 40;
$place_maxlength = 40;
$place_word_maxlength = 25;
$text_maxlength = 3000;
$text_minlength = 5;
$text_word_maxlength = 50;


$homepage_icon = "";
$email_icon = "";


$locale =                    array("en", "en_EN@euro", "eng");
$new_entry =                 "New entry";
$back =                      "Back";
$preview_marking =           "Preview";
$error_marking =             "Error:";
$optional_marking =          "(optional)";
$name_marking =              "Name:";
$email_marking =             "E-mail:";
$hp_marking =                "Homepage:";
$place_marking =             "Location:";
$comment_marking =           "Comment:";
$password_marking =          "Password:";
$password_wrong_marking =    "Password wrong!";
$submit_button =             "OK - Submit";
$preview_button =            "Preview";
$bbcode_exp =                "Text can be formatet with these codes: [ b]text[ /b] for <b>bold</b> text, [ i]text[ /i] for <i>italic</i> text.<br />To insert links: [link]http://www.domain.de/[/link] or [link=http://www.domain.de/]Link[/link]";
$error_no_name =             "No name entered";
$error_no_text =             "No message entered";
$error_email_wrong =         "E-mail address seems to be invalid";
$error_text_too_long =       "The message is too long ([characters] characters) - you can only enter up to [max_characters] characters";
$error_text_too_short =      "Your message is too short";
$error_word_too_long =       "The word \"[word]\" is long";
$error_already_made_entry =  "You already made an entry in the last 5 minutes, try again later";
$error_spam =                "Spam protection check failed";
$spam_check =                'Spam protection check:';
$delete_entry_marking =      "Delete entry:";
$delete_entry_conf_marking = "Are you sure that you want to delete the entry by <b>[name]</b>?";
$no_authorisation_marking =  "No authorisation, please log in.";
$log_in_marking =            "log in";
$edit_button =               "edit";
$delete_button =             "delete";
$delete_conf_button =        "OK - Delete";
$previous_page =             "Previous page";
$next_page =                 "Next page";
$still_no_entries_marking =  "No entries yet.";
$mail_subject =              "New entry in guestbook";
$hp_link_marking =           "Homepage";
$email_link_marking =        "E-mail";


session_start();

function bbcode($string)
 {
  $string = preg_replace("#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $string);
  $string = preg_replace("#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $string);
  $string = preg_replace("#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $string);
  $string = preg_replace("#\[link\]www\.(.+?)\[/link\]#is", "<a href=\"http://www.\\1\">www.\\1</a>", $string);
  $string = preg_replace("#\[link\](.+?)\[/link\]#is", "<a href=\"\\1\">\\1</a>", $string);
  $string = preg_replace("#\[link=(.+?)\](.+?)\[/link\]#is", "<a href=\"\\1\">\\2</a>", $string);
  $string = preg_replace("#\[url\]www\.(.+?)\[/url\]#is", "<a href=\"http://www.\\1\">www.\\1</a>", $string);
  $string = preg_replace("#\[url\](.+?)\[/url\]#is", "<a href=\"\\1\">\\1</a>", $string);
  $string = preg_replace("#\[url=(.+?)\](.+?)\[/url\]#is", "<a href=\"\\1\">\\2</a>", $string);
  return $string;
 }

function smilies($string)
 {
  global $smiley_folder;
  $string = str_replace(":-)", "<img src=\"".$smiley_folder."smile.gif\" alt=\":-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("(-:", "<img src=\"".$smiley_folder."smile.gif\" alt=\":-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":)", "<img src=\"".$smiley_folder."smile.gif\" alt=\":)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("(:", "<img src=\"".$smiley_folder."smile.gif\" alt=\":)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(";-)", "<img src=\"".$smiley_folder."wink.gif\" alt=\";-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(";)", "<img src=\"".$smiley_folder."wink.gif\" alt=\";-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-D", "<img src=\"".$smiley_folder."biggrin.gif\" alt=\":-D\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":D", "<img src=\"".$smiley_folder."biggrin.gif\" alt=\":D\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-P", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-P\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-p", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":p", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":P", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-|", "<img src=\"".$smiley_folder."neutral.gif\" alt=\":-|\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":|", "<img src=\"".$smiley_folder."neutral.gif\" alt=\":|\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-(", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":(", "<img src=\"".$smiley_folder."frown.gif\" alt=\":(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(")-:", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("):", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  return $string;
 }

function make_link($string)
 {
  $string = ' ' . $string;
  $string = preg_replace("#(^|[\n ])([\w]+?://.*?[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\">\\2</a>", $string);
  $string = preg_replace("#(^|[\n ])((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^ \"\t\n\r<]*)?)#is", "\\1<a href=\"http://\\2\">\\2</a>", $string);
  $string = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $string);
  $string = substr($string, 1);
  return $string;
 }

function browse()
 {
  global $p, $entries_per_page, $entry_count, $previous_page, $next_page;

  if ($entry_count > $entries_per_page)
  {
   $new_index_before = $p - 1;
   $new_index_after = $p + 1;
   $site_count = ceil($entry_count / $entries_per_page);
   ?><p class="gb-browse"><?php
   if ($new_index_before >= 0) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_before; ?>" title="<?php echo $previous_page; ?>">&laquo;</a>&nbsp;<?php }
   if ($new_index_before >= 0 && $new_index_before < $site_count) echo "";
   if ($p==0) { ?><span class="caution">1</span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=0">1</a>&nbsp;<?php }
   for($x=$p-3; $x<$p+4; $x++)
    {
     if ($x > 0 && $x < $site_count) { if ($x==$p) { ?><span class="caution"><?php echo $x+1; ?></span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $x; ?>"><?php echo $x+1; ?></a>&nbsp;<?php } }
    }
   if ($new_index_after < $site_count) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_after; ?>" title="<?php echo $next_page; ?>">&raquo;</a><?php }
   ?></p><?php
  }
 }

if (isset($_POST['action'])) $action = $_POST['action'];
if (isset($_GET['action'])) $action = $_GET['action'];

if (isset($_POST['login_password']))
 {
  if ($_POST['login_password'] == $password)
   {
    $_SESSION['admin'] = true;
    header("location: ".basename($_SERVER["PHP_SELF"]));
    die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
   }
  else { $action="none"; $show="login failed"; }
 }

if (isset($_POST['edit']))
 {
  if (isset($_SESSION['admin']))
   {
    $data = file($gbdata);
    $row_count = count($data);
    for ($row = 0; $row < $row_count; $row++)
     {
      $parts = explode("|", $data[$row]);
      if ($parts[0] == $_POST['entry_uniqid'])
       {
        $entry_uniqid = $parts[0];
        $time = $parts[1];
        $ip = $parts[2];
        $name = urldecode($parts[3]);
        $email = base64_decode(urldecode($parts[4]));
        $hp = urldecode($parts[5]);
        $place = urldecode($parts[6]);
        $text = urldecode($parts[7]);
        $comment = urldecode($parts[8]);
        break;
       }
     }
    $action="edit";
    $show="form";
   }
  else { $action = "none"; $show = "no authorization"; }
 }


if (isset($_POST['delete']) && isset($_POST['entry_uniqid']))
 {
  if (isset($_SESSION['admin']))
   {
    $data = file($gbdata);
    $row_count = count($data);
    $fp = fopen($gbdata, 'w+');
    flock($fp, 2);
    for ($row = 0; $row < $row_count; $row++)
     {
      $parts = explode("|", $data[$row]);
      if ($parts[0] != $_POST['entry_uniqid']) { fwrite($fp, trim($data[$row])."\n"); }
     }
    flock($fp, 3);
    fclose($fp);

    header("location: ".basename($_SERVER["PHP_SELF"]));
    die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
   }
  else { $action = "none"; $show = "no authorization"; }
 }

if (isset($_POST['form_submited']))
{
 // &uuml;bergebene Variablen ermitteln:
 if (isset($_POST['time'])) $time = $_POST['time'];
 if (isset($_POST['entry_uniqid'])) $entry_uniqid = $_POST['entry_uniqid'];
 $name = $_POST['name'];
 $text = $_POST['text'];
 $place = $_POST['place'];
 $email = $_POST['email'];
 $hp = $_POST['hp'];
 if (isset($_POST['comment'])) $comment = $_POST['comment']; else $comment="xxx";
 // unn&ouml;tige Leerzeichen abschneiden:
 $name = trim($name);
 $email = trim($email);
 $hp = trim($hp);
 $place = trim($place);
 $text = trim($text);
 $comment = trim($comment);
 if ($comment=="") $comment="xxx";
 // "http://" von Homepage abschneiden:
 if (substr($hp,0,7) == "http://") { $hp = substr($hp,7); }
 // &Uuml;berpr&uuml;fungen der Daten:
 unset($errors);

 $data = file($gbdata);
 foreach($data as $line)
  {
   if (trim($line)!="")
   {
   $parts = explode("|", $line);
   $saved_time = (int)$parts[1];
   if (time() < $saved_time+300 && $_SERVER["REMOTE_ADDR"] == $parts[2] && !isset($_SESSION['admin']))
    {
     $errors[] = $error_already_made_entry; break;
    }
   }
  }

 if ($name == "") $errors[] = $error_no_name;
 if ($text == "") $errors[] = $error_no_text;
 if(isset($email) && $email != "" and !preg_match("/^[^@]+@.+\.\D{2,5}$/", $email)) $errors[] = $error_email_wrong;
 if (strlen($text) > $text_maxlength) { $error_text_too_long = str_replace("[characters]", strlen($text), $error_text_too_long); $error_text_too_long = str_replace("[max_characters]", $text_maxlength, $error_text_too_long); $errors[] = $error_text_too_long; }
 if ($text != "" && strlen($text) < $text_minlength) $errors[] = $error_text_too_short;
 // Schauen, ob zu lange Wörter vorhanden sind:
 $text_arr = explode(" ",$name); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $name_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$name_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }
 $text_arr = explode(" ",$place); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $place_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$place_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }
 $text_arr = str_replace("\n", " ", $text);
 if ($bbcode == true); { $text_arr = preg_replace("#\[b\](.+?)\[/b\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[i\](.+?)\[/i\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[u\](.+?)\[/u\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[link\](.+?)\[/link\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[link=(.+?)\](.+?)\[/link\]#is", "\\2", $text_arr); }
 $text_arr = explode(" ",$text_arr); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $text_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$text_word_maxlength)))."...", $error_word_too_long);$errors[] = $error_word_too_long_x; } }

  if(isset($_POST['entry']) && $action!='edit')
   {
    $z1 = intval($_POST["z1"]);
    $z2 = intval($_POST["z2"]);
    $gerechnet = intval($_POST["gerechnet"]);
    $rechencheck = $z1 + $z2;
    if ($gerechnet != $rechencheck || empty($gerechnet) || empty($rechencheck))
    $errors[] = $error_spam;
   } 


 if (empty($errors) && isset($_POST['entry']) && $action=="entry")
  {
   $time = time();
   $text = urlencode($text);
   $name = urlencode($name);
   $email = urlencode(base64_encode($email));
   $hp = urlencode($hp);
   $place = urlencode($place);
   $ip = $_SERVER["REMOTE_ADDR"];
   $comment = urlencode($comment);
   $entry = uniqid("")."|".$time."|".$ip."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n";
   $data = file($gbdata);
   $c = count($data);
   $fp = fopen($gbdata, 'w+');
   flock($fp, 2);
   fwrite($fp, $entry);
   for ($i = 0; $i < $c; $i++) { fwrite($fp, trim($data[$i])."\n"); }
   flock($fp, 3);
   fclose($fp);


   if (isset($adminemail) && $adminemail != "")
   {
    $emailbody = urldecode($text);
    $absender = urldecode($name);
    if ($email != "") $absender_email = base64_decode(urldecode($email)); else $absender_email = "no@ema.il";
    $header= "From: ".$absender."<".$absender_email.">\n";    $header .= "X-Mailer: PHP/" . phpversion(). "\n";
    $header .= "X-Sender-IP: ".$_SERVER['REMOTE_ADDR']."\n";
    $header .= "Content-Type: text/plain";
    @mail($adminemail, $mail_subject, $emailbody, $header);
   }
   header("location: ".basename($_SERVER["PHP_SELF"]));
   die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
  }

 elseif (empty($errors) && isset($_POST['entry']) && $action=="edit")
  {
   if(isset($_SESSION['admin']))
    {
     $entry_uniqid = $_POST['entry_uniqid'];
     $name = urlencode($name);
     $email = urlencode(base64_encode($email));
     $hp = urlencode($hp);
     $place = urlencode($place);
     $text = urlencode($text);
     $comment = urlencode($comment);
     $data = file($gbdata);
     $row_count = count($data);
     $fp = fopen($gbdata, "w+");
     flock($fp, 2);
     for ($row = 0; $row < $row_count; $row++)
      {
       $parts = explode("|", $data[$row]);
       if ($parts[0] == $entry_uniqid) { fwrite($fp, $parts[0]."|".$parts[1]."|".$parts[2]."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n"); }
       else { fwrite($fp, trim($data[$row])."\n"); }
      }
     flock($fp, 3);
     fclose($fp);
     header("location: ".basename($_SERVER["PHP_SELF"]));
     die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
    }
   else $show="no authorization";
  }
 else $show="form";
}

if (empty($action)) $action="main";

switch ($action)
 {
  case "main":
   if (isset($_GET['p'])) $p = $_GET['p'];
   $data = file($gbdata);
   $entry_count = count($data);
   if (empty($p)) $p = 0;
   $last = ($p+1) * $entries_per_page;
   if ($last > $entry_count) $last = $entry_count;
   $show="main";
  break;
  case "entry":
   $show="form";
  break;
  case "login":
   if (isset($_SESSION['admin'])) { session_destroy(); header("location: ".basename($_SERVER["PHP_SELF"])); die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>"); }
   else $show="login form";
  break;
 }

setlocale(LC_ALL, $locale);


?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $guestbook_title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body                { font-family: Verdana,Arial,Helvetica,sans-serif; color: #000000; font-size:13px; background-color: #fffff3; margin: 0px; padding: 20px; }
h1                  { margin: 0px 0px 20px 0px; font-size:18px; font-weight:bold; }
div.gb              { margin: 0px 0px 20px 0px; padding: 0px; border: 1px solid #ffcc00; line-height: 19px; }
div.gb-author       { margin: 0px; padding: 1px 10px 1px 10px; border-bottom: 1px solid #ffcc00; background: #ffffcc; }
p.gb-author-left    { margin: 0px; float: left; }
p.gb-author-right   { margin: 0px; text-align: right; }
div.gb-entry        { margin: 10px; padding: 0px; }
p.gb-browse         { text-align: right; font-weight: bold; }
p.gb-admin-buttons  { margin: 5px 0px 0px 0px; text-align: right; }
.caution            { color: red; font-weight: bold; }
.small              { font-size: 11px; line-height:16px; }
.comment            { margin: 10px 0px 0px 0px; color: #808080; font-style: italic; }
img                 { border: 0px; }
a:link              { color: #0000cc; text-decoration: none; }
a:visited           { color: #0000cc; text-decoration: none; }
a:hover             { color: #0000ff; text-decoration: underline; }
a:active            { color: #ff0000; text-decoration: none; }
-->
</style>
</head>
<body>
<h1><?php echo $guestbook_title; ?></h1>
<p class="gb-browse">
<?php if ($show=="main") { ?>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=entry"><?php echo $new_entry; ?></a> ]<?php }
else { ?>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><?php echo $back; ?></a> ]<?php } ?>
</p>
<?php
switch ($show)
 {
  case "main":
  if ($entry_count == 0) { echo "<i>".$still_no_entries_marking."</i>"; }
  for ($i = $p*$entries_per_page; $i < $last; $i++)
   {
    if (trim($data[$i]) != "")
    {
    $nr = $entry_count -$i;
    $parts = explode("|", $data[$i]);
    $name = urldecode($parts[3]);
    $email = base64_decode(urldecode($parts[4]));
    if ($email != "")
     {
      $email_parts = explode("@", $email);
      $email_name = $email_parts[0];
      $email_domain_tld = $email_parts[1];
      $domain_parts = explode(".", $email_domain_tld);
      $email_domain = "";
      for ($x = 0; $x < count($domain_parts)-1; $x++)
       {
        $email_domain .= $domain_parts[$x].".";
       }
      $email_tld = $domain_parts[$x];
     }
    $hp = urldecode($parts[5]);
    $place = urldecode($parts[6]);
    $text = urldecode($parts[7]);
    $comment = urldecode($parts[8]);
    $text = htmlspecialchars(stripslashes($text));
    #$text = htmlspecialchars(stripslashes($text));
    $text = nl2br($text);
    if ($autolink == true) $text = make_link($text);
    if ($bbcode == true) $text = bbcode($text);
    if (isset($smiley_folder) && $smiley_folder != "") $text = smilies($text);
    $comment = htmlspecialchars(stripslashes($comment));
    $comment = nl2br($comment);
    if ($autolink == true) $comment = make_link($comment);
    if ($bbcode == true) $comment = bbcode($comment);
    if (isset($smiley_folder) && $smiley_folder != "") $comment = smilies($comment);
    ?>
    <div class="gb">
    <div class="gb-author">
    <p class="gb-author-left">
    <?php
    echo "<b>" . htmlspecialchars(stripslashes($name)) . "</b>";
    if ($email != "" or $hp != "") { echo "&nbsp;&nbsp;<span class=\"small\">"; }
    if ($hp != "") { if (isset($homepage_icon) && $homepage_icon != "") { ?><a href="http://<?php echo $hp; ?>"><img src="<?php echo $homepage_icon; ?>" alt="<?php echo $hp_link_marking; ?>" title="<?php echo $hp_link_marking; ?>" /></a><?php } else echo "[ <a href=\"http://" .$hp ."\">".$hp_link_marking."</a> ]"; }
    if ($email != "" && $hp != "") { echo "&nbsp;"; }
    if ($email != "") { if (empty($email_icon) or $email_icon == "") echo "[ "; ?><script type="text/javascript">
    <!--
    document.write('<a href="mai'); document.write('lto:<?php echo $email_name; ?>'); document.write('@'); document.write('<?php echo $email_domain; ?>'); document.write('<?php echo $email_tld; ?>'); document.write('">');
    //-->
    </script><?php if (isset($email_icon) && $email_icon != "") { ?><img src="<?php echo $email_icon; ?>" alt="<?php echo $email_link_marking; ?>" title="<?php echo $email_link_marking; ?>" /><?php } else echo $email_link_marking;
    ?><script type="text/javascript">
    <!--
    document.write('</a>');
    //-->
    </script><?php
    if (empty($email_icon) or $email_icon == "") echo " ]"; }
    if ($email != "" or $hp != "") echo "</span>";
    ?></p>
    <p class="gb-author-right">
    <?php
    if ($place != "") { echo htmlspecialchars(stripslashes($place)) . ", "; }
    echo strftime($time_format, $parts[1]);
    ?></p></div>
    <div class="gb-entry"><?php echo $text; ?>
    <?php if (substr($comment,0,3)!="xxx") { ?><p class="comment"><?php echo $comment; ?></p><?php }
    if (isset($_SESSION['admin'])) { ?><form method="post" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><p class="gb-admin-buttons"><input type="hidden" name="entry_uniqid" value="<?php echo $parts[0]; ?>" /><input type="hidden" name="delete_name" value="<?php echo $parts[3]; ?>" /><input type="submit" name="edit" value="<?php echo $edit_button; ?>" />&nbsp;<input style="color:red; font-weight:bold;" type="submit" name="delete" value="<?php echo $delete_button; ?>" /></p></form><?php }
    ?></div></div>
    <?php
    }
   }
   browse();
  break;

  case "form":
   if(isset($errors))
    {
     ?><p class="caution"><?php echo $error_marking; ?></p><ul><?php foreach($errors as $f) { ?><li><?php echo $f; ?></li><?php } ?></ul><br /><?php
    }
   elseif (empty($errors) && isset($_POST['preview']))
    {
     $pr_text = htmlspecialchars(stripslashes($text));
     $pr_text = nl2br($pr_text);
     if ($autolink == true) $pr_text = make_link($pr_text);
     if ($bbcode == true) $pr_text = bbcode($pr_text);
     if (isset($smiley_folder) && $smiley_folder != "") $pr_text = smilies($pr_text);
     $pr_comment = htmlspecialchars(stripslashes($comment));
     $pr_comment = nl2br($pr_comment);
     if ($autolink == true) $pr_comment = make_link($pr_comment);
     if ($bbcode == true) $pr_comment = bbcode($pr_comment);
     if (isset($smiley_folder) && $smiley_folder != "") $pr_comment = smilies($pr_comment);
     ?>
     <p class="caution"><?php echo $preview_marking; ?></p>
     <div class="gb">
     <div class="gb-author">
     <p class="gb-author-left">
     <?php
     echo "<b>" . htmlspecialchars(stripslashes($name)) . "</b>";
     if ($email != "" or $hp != "") { echo "&nbsp;&nbsp;<span class=\"small\">"; }
     if ($hp != "") { if (isset($homepage_icon) && $homepage_icon != "") { ?><a href="http://<?php echo $hp; ?>"><img src="<?php echo $homepage_icon; ?>" alt="<?php echo $hp_link_marking; ?>" /></a><?php } else echo "[ <a href=\"http://" .$hp ."\">".$hp_link_marking."</a> ]"; }
     if ($email != "" && $hp != "") { echo "&nbsp;"; }
     if ($email != "") { if (isset($email_icon) && $email_icon != "") { ?><a href="mailto:<?php echo $email; ?>"><img src="<?php echo $email_icon; ?>" alt="<?php echo $email_link_marking; ?>" /></a><?php } else echo "[ <a href=\"mailto:" .$email ."\">".$email_link_marking."</a> ]"; }
     if ($email != "" or $hp != "") { echo "&nbsp;&nbsp;</span>"; }
     ?>
     </p>
     <p class="gb-author-right">
     <?php
     if ($place != "") { echo htmlspecialchars(stripslashes($place)) . ",&nbsp;"; }
     if ($action=="edit") { echo strftime($time_format, $_POST['time']); } else echo strftime($time_format);
     ?></p></div>
     <div class="gb-entry"><?php echo $pr_text; ?>
     <?php if (substr($pr_comment,0,3)!="xxx") { ?><p class="comment"><?php echo $pr_comment; ?></span></p><?php } ?>
     </div>
     </div><br />
     <?php
    }
   ?><form method="post" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><div>
   <input type="hidden" name="form_submited" value="true" />
   <input type="hidden" name="action" value="<?php echo $action; ?>" />
   <?php if ($action=="edit") { ?><input type="hidden" name="entry_uniqid" value="<?php echo $entry_uniqid; ?>" /><input type="hidden" name="time" value="<?php echo $time; ?>" /><?php } ?>
   <table class="normal" border="0" cellpadding="3" cellspacing="0">
    <tr>
     <td><b><?php echo $name_marking; ?></b></td>
     <td><input type="text" name="name" value="<?php if (isset($name)) echo htmlspecialchars(stripslashes($name)); else echo ""; ?>" size="40" maxlength="<?php echo $name_maxlength; ?>" /></td>
    </tr>
    <tr>
     <td><b><?php echo $email_marking; ?></b></td>
     <td><input type="text" name="email" value="<?php if (isset($email)) echo htmlspecialchars(stripslashes($email)); else echo ""; ?>" size="40" maxlength="<?php echo $email_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td><b><?php echo $hp_marking; ?></b></td>
     <td><input type="text" name="hp" value="<?php if (isset($hp)) echo htmlspecialchars(stripslashes($hp)); else echo ""; ?>" size="40" maxlength="<?php echo $hp_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td><b><?php echo $place_marking; ?></b></td>
     <td><input type="text" name="place" value="<?php if (isset($place)) echo htmlspecialchars(stripslashes($place)); else echo ""; ?>" size="40" maxlength="<?php echo $place_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td colspan="2"><br /><textarea name="text" cols="59" rows="13"><?php if (isset($text)) echo htmlspecialchars(stripslashes($text)); else echo ""; ?></textarea></td>
    </tr><?php
    if($action!='edit')
    { ?><tr>
      <td colspan="2">
        <?php
          srand((double)microtime() * 1000000);
          $zahl1 = rand(1, 50);
          $zahl2 = rand(1, 9); 
          ?><input type="hidden" name="z1" value="<?php echo $zahl1; ?>" />
          <input type="hidden" name="z2" value="<?php echo $zahl2 ?>" />
          <?php echo $spam_check; ?> <?php echo $zahl1; ?> + <?php echo $zahl2; ?> = <input type="text" name="gerechnet" size="2" maxlength="2" />
      </td>
    </tr><?php
    }
    if ($action=='edit') 
    {
    ?><tr>
     <td colspan="2"><b><?php echo $comment_marking; ?></b><br /><textarea name="comment" cols="59" rows="5"><?php if (isset($comment) && substr($comment,0,3)!="xxx") echo htmlspecialchars(stripslashes($comment)); ?></textarea></td>
    </tr>
    <?php } ?>
    <tr>
     <td colspan="2"><br /><input type="submit" name="entry" value="<?php echo $submit_button; ?>" />&nbsp;<input type="submit" name="preview" value="<?php echo $preview_button; ?>" /></td>
     <td>&nbsp;</td>
    </tr>
   </table>
   </div></form>
   <?php if ($bbcode==true) { ?><p class="small"><br /><?php echo $bbcode_exp; ?></p><?php }

  break;

  case "login form":
   ?>
   <form action="<?php echo basename($_SERVER["PHP_SELF"]); ?>" method="post">
   <p><b><?php echo $password_marking; ?></b><br /><input type="password" name="login_password" />&nbsp;<input type="submit" value="<?php echo $log_in_marking; ?>" /></p>
   </form>
   <?php
  break;

  case "login failed":
   ?><p class="caution"><?php echo $password_wrong_marking; ?></p><?php
  break;

  case "no authorization":
   ?><p class="caution"><?php echo $no_authorisation_marking; ?></p><p>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=login"><?php echo $log_in_marking; ?></a> ]</p><?php
  break;
 }



?><p class="small" style="text-align: right;"><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=login">Admin-Login</a> | powered by <a href="http://mylittlehomepage.net/code_collection">my little guestbook</a></p>

</p>
            </TABLE>

    <BR>
    </TABLE>

    <BR>
<BR>
<TR>
<TD BACKGROUND="images/bottom.jpg" HEIGHT=70>



<BR>
<BR>
</TABLE>


</BODY>
</HTML>

Muste ein Paar Kommentare asu dem GB kürzen dami ich es posten konnte aber das macht nichts

MFG MOE
 
Danke erst mal für Deine Mühe.

Ich gebe Dir nochmals das ganze (originale) GB PHP. Script. Vielleicht war das von mir angefügte unvollstänig.
Gebe ich Deinen Code ein, bekomm ich nur wirre Texte zurück. :(

Hier ORIGINAL GB Script
Code:
<?php 


// Settings:

// Name of guestbook:
$guestbook_title = 'Guestbook';

// Administration password:
$password = 'admin';

// File in which the entries will be saved (requires CHMOD 666):
$gbdata = "guestbook.dat";

// How many entries per page?
$entries_per_page = 10;

// Admin E-mail for notifications (optional):
$adminemail = '';

// BB-Codes on?
$bbcode = false;

/// Make links clickable:
$autolink = true;

// If you want to use smilies specify the smiley folder e.g. "img/" (where these 
// images are: smile.gif, wink.gif, biggrin.gif, tongue.gif, neutral.gif, frown.gif):
$smiley_folder = '';

// Time format:
$time_format = "%B %d, %Y, %H:%M";

// Length limitations:
$name_maxlength = 40;
$name_word_maxlength = 25;
$email_maxlength = 40;
$hp_maxlength = 40;
$place_maxlength = 40;
$place_word_maxlength = 25;
$text_maxlength = 3000;
$text_minlength = 5;
$text_word_maxlength = 50;

// Paths to images for Homepage and E-Mail links (optional):
$homepage_icon = "";
$email_icon = "";

// Language settings:
$locale =                    array("en", "en_EN@euro", "eng");
$new_entry =                 "New entry";
$back =                      "Back";
$preview_marking =           "Preview";
$error_marking =             "Error:";
$optional_marking =          "(optional)";
$name_marking =              "Name:";
$email_marking =             "E-mail:";
$hp_marking =                "Homepage:";
$place_marking =             "Location:";
$comment_marking =           "Comment:";
$password_marking =          "Password:";
$password_wrong_marking =    "Password wrong!";
$submit_button =             "OK - Submit";
$preview_button =            "Preview";
$bbcode_exp =                "Text can be formatet with these codes: [ b]text[ /b] for <b>bold</b> text, [ i]text[ /i] for <i>italic</i> text.<br />To insert links: [link]http://www.domain.de/[/link] or [link=http://www.domain.de/]Link[/link]";
$error_no_name =             "No name entered";
$error_no_text =             "No message entered";
$error_email_wrong =         "E-mail address seems to be invalid";
$error_text_too_long =       "The message is too long ([characters] characters) - you can only enter up to [max_characters] characters";
$error_text_too_short =      "Your message is too short";
$error_word_too_long =       "The word \"[word]\" is long";
$error_already_made_entry =  "You already made an entry in the last 5 minutes, try again later";
$error_spam =                "Spam protection check failed";
$spam_check =                'Spam protection check:';
$delete_entry_marking =      "Delete entry:";
$delete_entry_conf_marking = "Are you sure that you want to delete the entry by <b>[name]</b>?";
$no_authorisation_marking =  "No authorisation, please log in.";
$log_in_marking =            "log in";
$edit_button =               "edit";
$delete_button =             "delete";
$delete_conf_button =        "OK - Delete";
$previous_page =             "Previous page";
$next_page =                 "Next page";
$still_no_entries_marking =  "No entries yet.";
$mail_subject =              "New entry in guestbook";
$hp_link_marking =           "Homepage";
$email_link_marking =        "E-mail";

// End of settings

##############################################################################

session_start();

function bbcode($string)
 {
  $string = preg_replace("#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $string);
  $string = preg_replace("#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $string);
  $string = preg_replace("#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $string);
  $string = preg_replace("#\[link\]www\.(.+?)\[/link\]#is", "<a href=\"http://www.\\1\">www.\\1</a>", $string);
  $string = preg_replace("#\[link\](.+?)\[/link\]#is", "<a href=\"\\1\">\\1</a>", $string);
  $string = preg_replace("#\[link=(.+?)\](.+?)\[/link\]#is", "<a href=\"\\1\">\\2</a>", $string);
  $string = preg_replace("#\[url\]www\.(.+?)\[/url\]#is", "<a href=\"http://www.\\1\">www.\\1</a>", $string);
  $string = preg_replace("#\[url\](.+?)\[/url\]#is", "<a href=\"\\1\">\\1</a>", $string);
  $string = preg_replace("#\[url=(.+?)\](.+?)\[/url\]#is", "<a href=\"\\1\">\\2</a>", $string);
  return $string;
 }

function smilies($string)
 {
  global $smiley_folder;
  $string = str_replace(":-)", "<img src=\"".$smiley_folder."smile.gif\" alt=\":-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("(-:", "<img src=\"".$smiley_folder."smile.gif\" alt=\":-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":)", "<img src=\"".$smiley_folder."smile.gif\" alt=\":)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("(:", "<img src=\"".$smiley_folder."smile.gif\" alt=\":)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(";-)", "<img src=\"".$smiley_folder."wink.gif\" alt=\";-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(";)", "<img src=\"".$smiley_folder."wink.gif\" alt=\";-)\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-D", "<img src=\"".$smiley_folder."biggrin.gif\" alt=\":-D\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":D", "<img src=\"".$smiley_folder."biggrin.gif\" alt=\":D\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-P", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-P\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-p", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":p", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":P", "<img src=\"".$smiley_folder."tongue.gif\" alt=\":-p\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-|", "<img src=\"".$smiley_folder."neutral.gif\" alt=\":-|\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":|", "<img src=\"".$smiley_folder."neutral.gif\" alt=\":|\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":-(", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(":(", "<img src=\"".$smiley_folder."frown.gif\" alt=\":(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace(")-:", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  $string = str_replace("):", "<img src=\"".$smiley_folder."frown.gif\" alt=\":-(\" width=\"15\" height=\"15\" />", $string);
  return $string;
 }

function make_link($string)
 {
  $string = ' ' . $string;
  $string = preg_replace("#(^|[\n ])([\w]+?://.*?[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\">\\2</a>", $string);
  $string = preg_replace("#(^|[\n ])((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^ \"\t\n\r<]*)?)#is", "\\1<a href=\"http://\\2\">\\2</a>", $string);
  $string = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $string);
  $string = substr($string, 1);
  return $string;
 }

function browse()
 {
  global $p, $entries_per_page, $entry_count, $previous_page, $next_page;

  if ($entry_count > $entries_per_page)
  {
   $new_index_before = $p - 1;
   $new_index_after = $p + 1;
   $site_count = ceil($entry_count / $entries_per_page);
   ?><p class="gb-browse"><?php
   if ($new_index_before >= 0) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_before; ?>" title="<?php echo $previous_page; ?>">&laquo;</a>&nbsp;<?php }
   if ($new_index_before >= 0 && $new_index_before < $site_count) echo "";
   if ($p==0) { ?><span class="caution">1</span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=0">1</a>&nbsp;<?php }
   for($x=$p-3; $x<$p+4; $x++)
    {
     if ($x > 0 && $x < $site_count) { if ($x==$p) { ?><span class="caution"><?php echo $x+1; ?></span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $x; ?>"><?php echo $x+1; ?></a>&nbsp;<?php } }
    }
   if ($new_index_after < $site_count) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_after; ?>" title="<?php echo $next_page; ?>">&raquo;</a><?php }
   ?></p><?php
  }
 }

if (isset($_POST['action'])) $action = $_POST['action'];
if (isset($_GET['action'])) $action = $_GET['action'];

if (isset($_POST['login_password']))
 {
  if ($_POST['login_password'] == $password)
   {
    $_SESSION['admin'] = true;
    header("location: ".basename($_SERVER["PHP_SELF"]));
    die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
   }
  else { $action="none"; $show="login failed"; }
 }

if (isset($_POST['edit']))
 {
  if (isset($_SESSION['admin']))
   {
    $data = file($gbdata);
    $row_count = count($data);
    for ($row = 0; $row < $row_count; $row++)
     {
      $parts = explode("|", $data[$row]);
      if ($parts[0] == $_POST['entry_uniqid'])
       {
        $entry_uniqid = $parts[0];
        $time = $parts[1];
        $ip = $parts[2];
        $name = urldecode($parts[3]);
        $email = base64_decode(urldecode($parts[4]));
        $hp = urldecode($parts[5]);
        $place = urldecode($parts[6]);
        $text = urldecode($parts[7]);
        $comment = urldecode($parts[8]);
        break;
       }
     }
    $action="edit";
    $show="form";
   }
  else { $action = "none"; $show = "no authorization"; }
 }

// Eintrag löschen:
if (isset($_POST['delete']) && isset($_POST['entry_uniqid']))
 {
  if (isset($_SESSION['admin']))
   {
    $data = file($gbdata);
    $row_count = count($data);
    $fp = fopen($gbdata, 'w+');
    flock($fp, 2);
    for ($row = 0; $row < $row_count; $row++)
     {
      $parts = explode("|", $data[$row]);
      if ($parts[0] != $_POST['entry_uniqid']) { fwrite($fp, trim($data[$row])."\n"); }
     }
    flock($fp, 3);
    fclose($fp);

    header("location: ".basename($_SERVER["PHP_SELF"]));
    die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
   }
  else { $action = "none"; $show = "no authorization"; }
 }

// wenn Formular abgeschickt wurde:
if (isset($_POST['form_submited']))
{
 // &uuml;bergebene Variablen ermitteln:
 if (isset($_POST['time'])) $time = $_POST['time'];
 if (isset($_POST['entry_uniqid'])) $entry_uniqid = $_POST['entry_uniqid'];
 $name = $_POST['name'];
 $text = $_POST['text'];
 $place = $_POST['place'];
 $email = $_POST['email'];
 $hp = $_POST['hp'];
 if (isset($_POST['comment'])) $comment = $_POST['comment']; else $comment="xxx";
 // unn&ouml;tige Leerzeichen abschneiden:
 $name = trim($name);
 $email = trim($email);
 $hp = trim($hp);
 $place = trim($place);
 $text = trim($text);
 $comment = trim($comment);
 if ($comment=="") $comment="xxx";
 // "http://" von Homepage abschneiden:
 if (substr($hp,0,7) == "http://") { $hp = substr($hp,7); }
 // &Uuml;berpr&uuml;fungen der Daten:
 unset($errors);

 // Ckeck if IP already posted in the last 5 minutes:
 $data = file($gbdata);
 foreach($data as $line)
  {
   if (trim($line)!="")
   {
   $parts = explode("|", $line);
   $saved_time = (int)$parts[1];
   if (time() < $saved_time+300 && $_SERVER["REMOTE_ADDR"] == $parts[2] && !isset($_SESSION['admin']))
    {
     $errors[] = $error_already_made_entry; break;
    }
   }
  }

 if ($name == "") $errors[] = $error_no_name;
 if ($text == "") $errors[] = $error_no_text;
 if(isset($email) && $email != "" and !preg_match("/^[^@]+@.+\.\D{2,5}$/", $email)) $errors[] = $error_email_wrong;
 if (strlen($text) > $text_maxlength) { $error_text_too_long = str_replace("[characters]", strlen($text), $error_text_too_long); $error_text_too_long = str_replace("[max_characters]", $text_maxlength, $error_text_too_long); $errors[] = $error_text_too_long; }
 if ($text != "" && strlen($text) < $text_minlength) $errors[] = $error_text_too_short;
 // Schauen, ob zu lange Wörter vorhanden sind:
 $text_arr = explode(" ",$name); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $name_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$name_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }
 $text_arr = explode(" ",$place); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $place_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$place_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }
 $text_arr = str_replace("\n", " ", $text);
 if ($bbcode == true); { $text_arr = preg_replace("#\[b\](.+?)\[/b\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[i\](.+?)\[/i\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[u\](.+?)\[/u\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[link\](.+?)\[/link\]#is", "\\1", $text_arr); $text_arr = preg_replace("#\[link=(.+?)\](.+?)\[/link\]#is", "\\2", $text_arr); }
 $text_arr = explode(" ",$text_arr); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $text_word_maxlength) {
 $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$text_word_maxlength)))."...", $error_word_too_long);$errors[] = $error_word_too_long_x; } }

  if(isset($_POST['entry']) && $action!='edit')
   {
    $z1 = intval($_POST["z1"]);
    $z2 = intval($_POST["z2"]);
    $gerechnet = intval($_POST["gerechnet"]);
    $rechencheck = $z1 + $z2;
    if ($gerechnet != $rechencheck || empty($gerechnet) || empty($rechencheck))
    $errors[] = $error_spam;
   } 

 // save entry when no errors:
 if (empty($errors) && isset($_POST['entry']) && $action=="entry")
  {
   $time = time();
   $text = urlencode($text);
   $name = urlencode($name);
   $email = urlencode(base64_encode($email));
   $hp = urlencode($hp);
   $place = urlencode($place);
   $ip = $_SERVER["REMOTE_ADDR"];
   $comment = urlencode($comment);
   $entry = uniqid("")."|".$time."|".$ip."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n";
   $data = file($gbdata);
   $c = count($data);
   $fp = fopen($gbdata, 'w+');
   flock($fp, 2);
   fwrite($fp, $entry);
   for ($i = 0; $i < $c; $i++) { fwrite($fp, trim($data[$i])."\n"); }
   flock($fp, 3);
   fclose($fp);

   // e-mail notification:
   if (isset($adminemail) && $adminemail != "")
   {
    $emailbody = urldecode($text);
    $absender = urldecode($name);
    if ($email != "") $absender_email = base64_decode(urldecode($email)); else $absender_email = "no@ema.il";
    $header= "From: ".$absender."<".$absender_email.">\n";    $header .= "X-Mailer: PHP/" . phpversion(). "\n";
    $header .= "X-Sender-IP: ".$_SERVER['REMOTE_ADDR']."\n";
    $header .= "Content-Type: text/plain";
    @mail($adminemail, $mail_subject, $emailbody, $header);
   }
   header("location: ".basename($_SERVER["PHP_SELF"]));
   die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
  }

 elseif (empty($errors) && isset($_POST['entry']) && $action=="edit")
  {
   if(isset($_SESSION['admin']))
    {
     $entry_uniqid = $_POST['entry_uniqid'];
     $name = urlencode($name);
     $email = urlencode(base64_encode($email));
     $hp = urlencode($hp);
     $place = urlencode($place);
     $text = urlencode($text);
     $comment = urlencode($comment);
     $data = file($gbdata);
     $row_count = count($data);
     $fp = fopen($gbdata, "w+");
     flock($fp, 2);
     for ($row = 0; $row < $row_count; $row++)
      {
       $parts = explode("|", $data[$row]);
       if ($parts[0] == $entry_uniqid) { fwrite($fp, $parts[0]."|".$parts[1]."|".$parts[2]."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n"); }
       else { fwrite($fp, trim($data[$row])."\n"); }
      }
     flock($fp, 3);
     fclose($fp);
     header("location: ".basename($_SERVER["PHP_SELF"]));
     die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>");
    }
   else $show="no authorization";
  }
 else $show="form";
}

if (empty($action)) $action="main";

switch ($action)
 {
  case "main":
   if (isset($_GET['p'])) $p = $_GET['p'];
   $data = file($gbdata);
   $entry_count = count($data);
   if (empty($p)) $p = 0;
   $last = ($p+1) * $entries_per_page;
   if ($last > $entry_count) $last = $entry_count;
   $show="main";
  break;
  case "entry":
   $show="form";
  break;
  case "login":
   if (isset($_SESSION['admin'])) { session_destroy(); header("location: ".basename($_SERVER["PHP_SELF"])); die("<a href=\"".basename($_SERVER["PHP_SELF"])."\">further...</a>"); }
   else $show="login form";
  break;
 }

setlocale(LC_ALL, $locale);



################################################################################
// Begin HTML
// Here you could include a header --> include("header.html");
################################################################################
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $guestbook_title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body                { font-family: Verdana,Arial,Helvetica,sans-serif; color: #000000; font-size:13px; background-color: #fffff3; margin: 0px; padding: 20px; }
h1                  { margin: 0px 0px 20px 0px; font-size:18px; font-weight:bold; }
div.gb              { margin: 0px 0px 20px 0px; padding: 0px; border: 1px solid #ffcc00; line-height: 19px; }
div.gb-author       { margin: 0px; padding: 1px 10px 1px 10px; border-bottom: 1px solid #ffcc00; background: #ffffcc; }
p.gb-author-left    { margin: 0px; float: left; }
p.gb-author-right   { margin: 0px; text-align: right; }
div.gb-entry        { margin: 10px; padding: 0px; }
p.gb-browse         { text-align: right; font-weight: bold; }
p.gb-admin-buttons  { margin: 5px 0px 0px 0px; text-align: right; }
.caution            { color: red; font-weight: bold; }
.small              { font-size: 11px; line-height:16px; }
.comment            { margin: 10px 0px 0px 0px; color: #808080; font-style: italic; }
img                 { border: 0px; }
a:link              { color: #0000cc; text-decoration: none; }
a:visited           { color: #0000cc; text-decoration: none; }
a:hover             { color: #0000ff; text-decoration: underline; }
a:active            { color: #ff0000; text-decoration: none; }
-->
</style>
</head>
<body>
<h1><?php echo $guestbook_title; ?></h1>
<p class="gb-browse">
<?php if ($show=="main") { ?>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=entry"><?php echo $new_entry; ?></a> ]<?php }
else { ?>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><?php echo $back; ?></a> ]<?php } ?>
</p>
<?php
switch ($show)
 {
  case "main":
  if ($entry_count == 0) { echo "<i>".$still_no_entries_marking."</i>"; }
  for ($i = $p*$entries_per_page; $i < $last; $i++)
   {
    if (trim($data[$i]) != "")
    {
    $nr = $entry_count -$i;
    $parts = explode("|", $data[$i]);
    $name = urldecode($parts[3]);
    $email = base64_decode(urldecode($parts[4]));
    if ($email != "")
     {
      $email_parts = explode("@", $email);
      $email_name = $email_parts[0];
      $email_domain_tld = $email_parts[1];
      $domain_parts = explode(".", $email_domain_tld);
      $email_domain = "";
      for ($x = 0; $x < count($domain_parts)-1; $x++)
       {
        $email_domain .= $domain_parts[$x].".";
       }
      $email_tld = $domain_parts[$x];
     }
    $hp = urldecode($parts[5]);
    $place = urldecode($parts[6]);
    $text = urldecode($parts[7]);
    $comment = urldecode($parts[8]);
    $text = htmlspecialchars(stripslashes($text));
    #$text = htmlspecialchars(stripslashes($text));
    $text = nl2br($text);
    if ($autolink == true) $text = make_link($text);
    if ($bbcode == true) $text = bbcode($text);
    if (isset($smiley_folder) && $smiley_folder != "") $text = smilies($text);
    $comment = htmlspecialchars(stripslashes($comment));
    $comment = nl2br($comment);
    if ($autolink == true) $comment = make_link($comment);
    if ($bbcode == true) $comment = bbcode($comment);
    if (isset($smiley_folder) && $smiley_folder != "") $comment = smilies($comment);
    ?>
    <div class="gb">
    <div class="gb-author">
    <p class="gb-author-left">
    <?php
    echo "<b>" . htmlspecialchars(stripslashes($name)) . "</b>";
    if ($email != "" or $hp != "") { echo "&nbsp;&nbsp;<span class=\"small\">"; }
    if ($hp != "") { if (isset($homepage_icon) && $homepage_icon != "") { ?><a href="http://<?php echo $hp; ?>"><img src="<?php echo $homepage_icon; ?>" alt="<?php echo $hp_link_marking; ?>" title="<?php echo $hp_link_marking; ?>" /></a><?php } else echo "[ <a href=\"http://" .$hp ."\">".$hp_link_marking."</a> ]"; }
    if ($email != "" && $hp != "") { echo "&nbsp;"; }
    if ($email != "") { if (empty($email_icon) or $email_icon == "") echo "[ "; ?><script type="text/javascript">
    <!--
    document.write('<a href="mai'); document.write('lto:<?php echo $email_name; ?>'); document.write('@'); document.write('<?php echo $email_domain; ?>'); document.write('<?php echo $email_tld; ?>'); document.write('">');
    //-->
    </script><?php if (isset($email_icon) && $email_icon != "") { ?><img src="<?php echo $email_icon; ?>" alt="<?php echo $email_link_marking; ?>" title="<?php echo $email_link_marking; ?>" /><?php } else echo $email_link_marking;
    ?><script type="text/javascript">
    <!--
    document.write('</a>');
    //-->
    </script><?php
    if (empty($email_icon) or $email_icon == "") echo " ]"; }
    if ($email != "" or $hp != "") echo "</span>";
    ?></p>
    <p class="gb-author-right">
    <?php
    if ($place != "") { echo htmlspecialchars(stripslashes($place)) . ", "; }
    echo strftime($time_format, $parts[1]);
    ?></p></div>
    <div class="gb-entry"><?php echo $text; ?>
    <?php if (substr($comment,0,3)!="xxx") { ?><p class="comment"><?php echo $comment; ?></p><?php }
    if (isset($_SESSION['admin'])) { ?><form method="post" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><p class="gb-admin-buttons"><input type="hidden" name="entry_uniqid" value="<?php echo $parts[0]; ?>" /><input type="hidden" name="delete_name" value="<?php echo $parts[3]; ?>" /><input type="submit" name="edit" value="<?php echo $edit_button; ?>" />&nbsp;<input style="color:red; font-weight:bold;" type="submit" name="delete" value="<?php echo $delete_button; ?>" /></p></form><?php }
    ?></div></div>
    <?php
    }
   }
   browse();
  break;

  case "form":
   if(isset($errors))
    {
     ?><p class="caution"><?php echo $error_marking; ?></p><ul><?php foreach($errors as $f) { ?><li><?php echo $f; ?></li><?php } ?></ul><br /><?php
    }
   elseif (empty($errors) && isset($_POST['preview']))
    {
     $pr_text = htmlspecialchars(stripslashes($text));
     $pr_text = nl2br($pr_text);
     if ($autolink == true) $pr_text = make_link($pr_text);
     if ($bbcode == true) $pr_text = bbcode($pr_text);
     if (isset($smiley_folder) && $smiley_folder != "") $pr_text = smilies($pr_text);
     $pr_comment = htmlspecialchars(stripslashes($comment));
     $pr_comment = nl2br($pr_comment);
     if ($autolink == true) $pr_comment = make_link($pr_comment);
     if ($bbcode == true) $pr_comment = bbcode($pr_comment);
     if (isset($smiley_folder) && $smiley_folder != "") $pr_comment = smilies($pr_comment);
     ?>
     <p class="caution"><?php echo $preview_marking; ?></p>
     <div class="gb">
     <div class="gb-author">
     <p class="gb-author-left">
     <?php
     echo "<b>" . htmlspecialchars(stripslashes($name)) . "</b>";
     if ($email != "" or $hp != "") { echo "&nbsp;&nbsp;<span class=\"small\">"; }
     if ($hp != "") { if (isset($homepage_icon) && $homepage_icon != "") { ?><a href="http://<?php echo $hp; ?>"><img src="<?php echo $homepage_icon; ?>" alt="<?php echo $hp_link_marking; ?>" /></a><?php } else echo "[ <a href=\"http://" .$hp ."\">".$hp_link_marking."</a> ]"; }
     if ($email != "" && $hp != "") { echo "&nbsp;"; }
     if ($email != "") { if (isset($email_icon) && $email_icon != "") { ?><a href="mailto:<?php echo $email; ?>"><img src="<?php echo $email_icon; ?>" alt="<?php echo $email_link_marking; ?>" /></a><?php } else echo "[ <a href=\"mailto:" .$email ."\">".$email_link_marking."</a> ]"; }
     if ($email != "" or $hp != "") { echo "&nbsp;&nbsp;</span>"; }
     ?>
     </p>
     <p class="gb-author-right">
     <?php
     if ($place != "") { echo htmlspecialchars(stripslashes($place)) . ",&nbsp;"; }
     if ($action=="edit") { echo strftime($time_format, $_POST['time']); } else echo strftime($time_format);
     ?></p></div>
     <div class="gb-entry"><?php echo $pr_text; ?>
     <?php if (substr($pr_comment,0,3)!="xxx") { ?><p class="comment"><?php echo $pr_comment; ?></span></p><?php } ?>
     </div>
     </div><br />
     <?php
    }
   ?><form method="post" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><div>
   <input type="hidden" name="form_submited" value="true" />
   <input type="hidden" name="action" value="<?php echo $action; ?>" />
   <?php if ($action=="edit") { ?><input type="hidden" name="entry_uniqid" value="<?php echo $entry_uniqid; ?>" /><input type="hidden" name="time" value="<?php echo $time; ?>" /><?php } ?>
   <table class="normal" border="0" cellpadding="3" cellspacing="0">
    <tr>
     <td><b><?php echo $name_marking; ?></b></td>
     <td><input type="text" name="name" value="<?php if (isset($name)) echo htmlspecialchars(stripslashes($name)); else echo ""; ?>" size="40" maxlength="<?php echo $name_maxlength; ?>" /></td>
    </tr>
    <tr>
     <td><b><?php echo $email_marking; ?></b></td>
     <td><input type="text" name="email" value="<?php if (isset($email)) echo htmlspecialchars(stripslashes($email)); else echo ""; ?>" size="40" maxlength="<?php echo $email_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td><b><?php echo $hp_marking; ?></b></td>
     <td><input type="text" name="hp" value="<?php if (isset($hp)) echo htmlspecialchars(stripslashes($hp)); else echo ""; ?>" size="40" maxlength="<?php echo $hp_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td><b><?php echo $place_marking; ?></b></td>
     <td><input type="text" name="place" value="<?php if (isset($place)) echo htmlspecialchars(stripslashes($place)); else echo ""; ?>" size="40" maxlength="<?php echo $place_maxlength; ?>" />&nbsp;<span class="small"><?php echo $optional_marking; ?></span></td>
    </tr>
    <tr>
     <td colspan="2"><br /><textarea name="text" cols="59" rows="13"><?php if (isset($text)) echo htmlspecialchars(stripslashes($text)); else echo ""; ?></textarea></td>
    </tr><?php
    if($action!='edit')
    { ?><tr>
      <td colspan="2">
        <?php
          srand((double)microtime() * 1000000);
          $zahl1 = rand(1, 50);
          $zahl2 = rand(1, 9); 
          ?><input type="hidden" name="z1" value="<?php echo $zahl1; ?>" />
          <input type="hidden" name="z2" value="<?php echo $zahl2 ?>" />
          <?php echo $spam_check; ?> <?php echo $zahl1; ?> + <?php echo $zahl2; ?> = <input type="text" name="gerechnet" size="2" maxlength="2" />
      </td>
    </tr><?php
    }
    if ($action=='edit') 
    {
    ?><tr>
     <td colspan="2"><b><?php echo $comment_marking; ?></b><br /><textarea name="comment" cols="59" rows="5"><?php if (isset($comment) && substr($comment,0,3)!="xxx") echo htmlspecialchars(stripslashes($comment)); ?></textarea></td>
    </tr>
    <?php } ?>
    <tr>
     <td colspan="2"><br /><input type="submit" name="entry" value="<?php echo $submit_button; ?>" />&nbsp;<input type="submit" name="preview" value="<?php echo $preview_button; ?>" /></td>
     <td>&nbsp;</td>
    </tr>
   </table>
   </div></form>
   <?php if ($bbcode==true) { ?><p class="small"><br /><?php echo $bbcode_exp; ?></p><?php }

  break;

  case "login form":
   ?>
   <form action="<?php echo basename($_SERVER["PHP_SELF"]); ?>" method="post">
   <p><b><?php echo $password_marking; ?></b><br /><input type="password" name="login_password" />&nbsp;<input type="submit" value="<?php echo $log_in_marking; ?>" /></p>
   </form>
   <?php
  break;

  case "login failed":
   ?><p class="caution"><?php echo $password_wrong_marking; ?></p><?php
  break;

  case "no authorization":
   ?><p class="caution"><?php echo $no_authorisation_marking; ?></p><p>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=login"><?php echo $log_in_marking; ?></a> ]</p><?php
  break;
 }



?><p class="small" style="text-align: right;"><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=login">Admin-Login</a> | powered by <a href="http://mylittlehomepage.net/code_collection">my little guestbook</a></p>
</body>
</html>

Gruss + schöner Abend ominglow
 
Zurück