php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2007

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 02.01.2005, 19:31  
Gast
 
Beiträge: n/a
Standard Unbekanntes Problem mit Gästebuch

Hallo,

ich hoffe mir kann irgendjemand helfen. Ich hab schon bei Google geschaut und hier in der Suche, aber da ich auch nicht wirklich weiß was das Problem ist - wende ich mich hier hin.

Ich bin eine richtig blutige Anfängerin in PHP, also bitte habt Verständnis :wink:

Also folgendes:

Ich hab auf meiner Seite zwei Skins. Natürlich wollte ich, dass mein Gästebuch sich dem jeweiligen ausgesuchten Skin anpasst.

Das mit den Skins ist bei mir folgendermaßen: Ich hab jeweils ein Ordner für jeden Skin mit je einem Header, der css Datei und halt den Bildern.

Das Gästebuch hab ich von dieser Seite hier.

Das Script vom Gästebuch war folgender:

PHP-Code:
<?php
// #####################
// ### Gästebuch 2.2 ###
// #####################

// *********************
// *** Einstellungen ***
// *********************

// Titel des Gästebuchs.
$guestbook_title="Mein Gästebuch";

// Style des Gästebuches ("fire", "grey" oder "gaijin").
// (Die Stylesheet-Datei sollte natürlich an die eigene Seite angepasst werden.)
$guestbook_style="fire";

// Relativer Pfad zu der Datei, in der die Daten gespeichert werden.
$data_file="guestbook.dat";

// Relativer Pfad zum Verzeichnis, in dem sich die Bilder (space1.gif) befinden.
$images_path="images/";

// Relativer Pfad zum Verzeichnis, in dem sich die Smilies befinden.
// Ist kein Pfad angegeben, werden keine Smilies angezeigt.
$smilies_path="images/smilies/";

// Anzahl der Beiträge pro Seite.
$postspersite=10;

// Administration
$AdminLogin="admin";     // BITTE Ã„NDERN!
$AdminPasswd="password"// BITTE Ã„NDERN!

// *********************

function AuthUser() {
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;
  if((!isset(
$PHP_AUTH_USER)) || (!isset($PHP_AUTH_PW)) || ($PHP_AUTH_USER!=$AdminLogin) || ($PHP_AUTH_PW!=$AdminPasswd)){
    
header('WWW-Authenticate: Basic realm="Gaijins Guestbook - Administration"');
    
header('HTTP/1.0 401 Unauthorized');
    echo 
'<html><head></head><body>Authentifizierung erforderlich!

'
;
    echo 
'[url="guestbook.php"]Zurück zum Gästebuch[/url]
</body></html>'
;
    exit;
  }
}

if(
$action=="login") {
  
AuthUser();
}

if(
$action=="del") {
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)) {
    
DelPosting($data_file,$entry);
  }
}

// **************************************************************************
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Gästebuch</title>

<meta name="title" content="Gästebuch">
<meta name="description" content="Gästebuch">
<meta name="keywords" content="Gästebuch, G&auml;stebuch, Guestbook">
<meta name="author" content="Gaijin, http://www.gaijin.at/">
<meta http-equiv="content-language" content="de-at">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel="stylesheet" href="<?php echo $guestbook_style?>.css" type="text/css">

<script language="javascript">
function InsertMailGB(mailnam,mailsvr)
{
  document.write('[email="'+mailnam+'@'+mailsvr+'"]'+mailnam+'@'+mailsvr+'[/email]');
}
function add_smilie(sn)
{
  document.guestbook.gb_text.value=document.guestbook.gb_text.value+":_"+sn+"_:";
}
</script>

</head>
<body>






<table border=0 cellspacing=0 cellpadding=0><tr><td>

<?php

if($action=="post")
{
if(
strlen($gb_text)>1000) {
  
$gb_text=substr($gb_text,0,1000)."... (Text wurde gekürzt!)";
}
$gb_name=str_replace(chr(34),"''",$gb_name);
$gb_name=stripslashes($gb_name);
$gb_mail=strtolower(stripslashes($gb_mail));
$gb_home=strtolower(stripslashes($gb_home));
$gb_text=stripslashes(trim($gb_text));

if(
trim($gb_name=="")) $err_text.="Bitte gib Deinen Namen an.
"
;
if(
trim($gb_mail!="")) {
  if(!
ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$",$gb_mail))
    
$err_text.="Bitte gib eine gültige E-Mail-Adresse an (z.B.: [email]vorname.nachname@provider.at[/email]).
"
;
}
if(
trim($gb_home!="") && trim($gb_home!="http://")) {
  if((!
ereg("^http:\/\/(.{3,})\.(.{2,})",$gb_home)) || (ereg("\?",$gb_home)))
    
$err_text.="Bitte gib eine gültige URL an (z.B.: [url]http://www.seite.at/[/url]).
"
;
}

if(
trim($gb_text=="")) $err_text.="Bitte gib einen Text ein.
"
;
}

?>


<?php
// ******************************
// *** Neuer Gästebucheintrag ***
// ******************************
if(($action=="new") or trim($err_text!=""))
{
?>

<center>
<h1><?echo $guestbook_title?></h1>

<h2>Neuen Eintrag hinzufügen</h2>
</center>

<table border="0" cellspacing="0" cellpadding="1"><tr><form action="<?echo "$PHP_SELF"?>?action=post" method="post" name="guestbook"><td id="guestbooktable">
<table border="0" cellspacing="0" cellpadding="5"><tr><td id="guestbookinfo">

<?php
if(($send=="1") && trim($err_text!="")) {
  echo 
"

<big>[b]Fehler:[/b]</big>
"
;
  echo 
"<span id=red>$err_text</span></p>";
}
if(
trim($gb_home=="") && (!$gb_home)) $gb_home="http://";
?>

<table border=0 cellspacing=2 cellpadding=0 width=100%><tr>
<td valign=top>
<table border=0 cellspacing=2 cellpadding=0 width=100%>
<tr><td nowrap align=right id="guestbookinfo">Dein Name:</td><td nowrap align=right id="guestbookinfo"></td>
<td width=100%><input type="text" name="gb_name" size=50 maxlength=25 value="<?php echo $gb_name ?>"></td></tr>
<tr><td nowrap align=right id="guestbookinfo">Deine E-Mail-Adresse: <span id=red>[b]*[/b]</span></td><td></td>
<td width=100%><input type="text" name="gb_mail" size=50 maxlength=50 value="<?php echo $gb_mail ?>"></td></tr>
<tr><td nowrap align=right id="guestbookinfo">Deine Homepage: <span id=red>[b]*[/b]</span></td><td></td>
<td width=100%><input type="text" name="gb_home" size=50 maxlength=65 value="<?php echo $gb_home ?>"></td></tr>
<tr><td nowrap align=right valign=top id="guestbookinfo">Text:
[i](max. 1.000 Zeichen,
keine HTML-Tags)[/i]</td><td></td>
<td width=100%><textarea cols="50" rows="8" name="gb_text"><?php echo $gb_text ?></textarea></td></tr>
<tr><td id="guestbookinfo"><span id=red>[b]*[/b]</span>[i] = optionale Felder[/i]</td><td></td><td>
<input type="hidden" value="1" name="send">
<input type="submit" value="Senden" name="submit">
<input type="reset" value="Zurücksetzen" name="reset">
</td></tr>
</table>
</td><td></td><td width=100% valign=top id="guestbookinfo">
<?php
if($smilies_path) {
?>
[b]SMILIES:[/b]

[img]<?php echo $images_path?>space1.gif[/img]

[img]<?php echo $smilies_path?>smile.gif[/img]
[img]<?php echo $smilies_path?>wink.gif[/img]
[img]<?php echo $smilies_path?>happy.gif[/img]
[img]<?php echo $smilies_path?>sad.gif[/img]
[img]<?php echo $smilies_path?>puh.gif[/img]
[img]<?php echo $smilies_path?>yummie.gif[/img]
[img]<?php echo $smilies_path?>coool.gif[/img]

[img]<?php echo $smilies_path?>pukey.gif[/img]
[img]<?php echo $smilies_path?>devil.gif[/img]:->" onclick="javascript:add_smilie('devil');">
[img]<?php echo $smilies_path?>frown.gif[/img]
[img]<?php echo $smilies_path?>redface.gif[/img]
[img]<?php echo $smilies_path?>clown.gif[/img]
[img]<?php echo $smilies_path?>cry.gif[/img]
[img]<?php echo $smilies_path?>idea.gif[/img]

[img]<?php echo $smilies_path?>cwink.gif[/img]
[img]<?php echo $smilies_path?>grrr.gif[/img]
[img]<?php echo $smilies_path?>ill.gif[/img]
[img]<?php echo $smilies_path?>tooth.gif[/img]
[img]<?php echo $smilies_path?>psycho.gif[/img]
[img]<?php echo $smilies_path?>monster.gif[/img]
[img]<?php echo $smilies_path?>halt.gif[/img]

[img]<?php echo $smilies_path?>glass.gif[/img]
[img]<?php echo $smilies_path?>seek.gif[/img]
[img]<?php echo $smilies_path?>super.gif[/img]
[img]<?php echo $smilies_path?>help.gif[/img]
[img]<?php echo $smilies_path?>boxer.gif[/img]

[img]<?php echo $smilies_path?>dance.gif[/img]
[img]<?php echo $smilies_path?>alcohol.gif[/img]

[img]<?php echo $images_path?>space1.gif[/img]

<?php
}
?>
[b]TAGS:[/b]

[img]<?php echo $images_path?>space1.gif[/img]


<table border=0 cellspacing=0 cellpadding=0
<tr><td id="guestbookinfo" align="center"><b id="red">:b:[/b]</td><td id="guestbookinfo" align="center">bzw.</td><td id="guestbookinfo" align="center"><b id="red">:/b:[/b]</td><td id="guestbookinfo">für [b]fett[/b]</tr>
<tr><td id="guestbookinfo" align="center"><b id="red">:i:[/b]</td><td id="guestbookinfo" align="center">bzw.</td><td id="guestbookinfo" align="center"><b id="red">:/i:[/b]</td><td id="guestbookinfo">für [i]kursiv[/i]</tr>
<tr><td id="guestbookinfo" align="center"><b id="red">:u:[/b]</td><td id="guestbookinfo" align="center">bzw.</td><td id="guestbookinfo" align="center"><b id="red">:/u:[/b]</td><td id="guestbookinfo">für <u>unterstrichen</u></tr>
</table>

</td>
</tr></table>

</td></tr></table>
</td></form></tr></table>

<center>


<big>[b][url="<?php echo $PHP_SELF?>"]Zurück zum Gästebuch[/url][/b]</big>



<table border=0 cellspacing=0 cellpadding=0 width=570><tr><td id=guestbooktable>[img]space1.gif[/img]</tr></td></table>

[b]Powered by

[url="http://www.gaijin.at/"]www.gaijin.at[/url][/b]
</center>

</td></tr></table>
</body>
</html>

<?php
exit;
}

// **************************
// *** Gästebuch anzeigen ***
// **************************
if(!isset($first)) $first=0;
// *** Zu langen Text abschneiden ***
$first=abs(substr($first,0,5));

// *** Wenn Posting "gesendet" wurde und kein Fehlertext ausgegeben wurde ***
if(($send=="1") && trim($err_text=="")) {
  
$gb_date=date("YmdHis"); // *** Datum setzen ***
  
$line=file($data_file); // *** Daten in Array einlesen ***
  
rsort($line);  // *** Array in umgekehrter Reihenfolgen sortieren ***

  
$gb_name=str_replace("<","&lt;",$gb_name);
  
$gb_name=str_replace(">","&gt;",$gb_name);
  
$gb_name=str_replace("\"","&quot;",$gb_name);
  
$gb_name=str_replace("~","-",$gb_name);
  
$gb_name=str_replace("  "," ",$gb_name);
  
$gb_name=strip_tags($gb_name,"[b][i]<u><a><img>");

  
$gb_home=ereg_replace("(<|>| |\(|\)|\||\"|\')","",$gb_home);
  
$gb_home=str_replace("~","-",$gb_home);
  
$gb_home=urlencode($gb_home);
  if(
trim($gb_home=="http://")) $gb_home="";

  
$gb_text=str_replace("<","&lt;",$gb_text);
  
$gb_text=str_replace(">","&gt;",$gb_text);
  
$gb_text=str_replace("\"","&quot;",$gb_text);
  
$gb_text=str_replace("~","-",$gb_text);
  
$gb_text=str_replace("  "," ",$gb_text);
  
$gb_text=str_replace("\r\n","
"
,$gb_text);
  
$gb_text=urlencode($gb_text);
  
$gb_text=strip_tags($gb_text,"[b][i]<u><a><img>");

  
// *** Datei Ã¶ffnen und mit neuem Eintrag Ã¼berschreiben ***
  
$fp=fopen($data_file,"w");
  
flock($fp,2);
  
fputs($fp,"$gb_date|~#~|$gb_name|~#~|$gb_mail|~#~|$gb_home|~#~|$gb_text".chr(13).chr(10));

  
// *** Alte Einträge anhängen ***
  
for($i=0;$i<count($line);$i++) {
    
fputs($fp,$line[$i]);
  }
  
flock($fp,3);
  
fclose($fp);

  echo 
"<p id=red><big>[b]Danke für Deinen Eintrag![/b]</big></p>\n";

  
$gb_name="";
  
$gb_mail="";
  
$gb_home="";
  
$gb_text="";
  
$send="";
  
$err_text="";

}

?>

<center>
<h1><?echo $guestbook_title?></h1>
<big>[b][url="<?php echo $PHP_SELF?>?action=new"]Neuen Gästebucheintrag hinzufügen[/url][/b]</big>



</center>

<?php

$line
=@file($data_file);

// *** Startwert Ã¼berprüfen und ggf. setzen ***
if($first<0$first=0;
if(
$first>count($line)-1$first=count($line)-1;
// *** Anzahl der Postings/Seite Ã¼berprüfen und ggf. setzen ***
if($postspersite>count($line)) $postspersite=count($line);

// *** Postings nach Startwert und Anzahl/Seite anzeigen ***
for($i=$first;$i<$first+$postspersite;$i++) {
  
$p=explode("|~#~|",$line[$i],5);
  if((isset(
$p[0])) && ($i<count($line))) {
    
PrintPosting(count($line)-$i,$p[1],$p[2],$p[3],$p[0],$p[4]."
\n"
);
    
PrintPostingSpace();
  }
}

if(
$line)
{
  
// *** Navigationslinks generieren ***
  
$i=count($line)+$postspersite;
  
$j=$i;
  echo 
"<center>[b][i]Postings:[/i][/b] ";
  while(
$j>1) {
    
// *** Startwert für Link ***
    
$i-=$postspersite;
    if(
$i<1$i=1;
    
// *** Endwert für Link ***
    
$j=$i-$postspersite+1;
    if(
$j<1$j=1;
    
// *** Umgekehrte Reihenfolge der Postings!!! ;-) ***
    
$k=count($line)-$i;
    
// *** Navigationslinks ausgeben ***
    // *** (funktioniert auch für 1 Posting pro Seite!) ***
    
if($first==$k) {
      if(
$i!=$j) {echo "$i-$j";} else {echo "$i";}
    }else{
      echo 
"<nobr><a href=\"".$PHP_SELF."?first=$k\">";
      if(
$i!=$j) {echo "$i-$j";} else {echo "$i";}
      echo 
"</a>";
    }
    if(
$j>1) echo "|</nobr> ";
  }
  echo 
"</nobr>
</center>\n\n"
;
}

if(
$line)
{
  echo 
"<center>\n";
  echo 
"
\n"
;
  echo 
"<big>[b]<a href=\"".$PHP_SELF."?action=new\">Neuen Gästebucheintrag hinzufügen</a>[/b]</big>
\n"
;
  echo 
"</center>\n";
}

?>

<center>


<table border=0 cellspacing=0 cellpadding=0 width=570><tr><td id=guestbooktable>[img]space1.gif[/img]</tr></td></table>

Administration: [b][url="<?php echo $PHP_SELF."]">Login[/url][/b]



[
b]Powered by

[url="http://www.gaijin.at/"]www.gaijin.at[/url][/b]
</
center>

</
td></tr></table>
</
body>
</
html>

<?
php


// ############################################################################

function PrintPosting($PostNo,$PostName,$PostMail,$PostHome,$PostTime,$PostMsg)
{
  global 
$smilies_path;
  global 
$images_path;
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;

  
$OrigTime=$PostTime;
  
$PostTime=substr($PostTime,6,2).".".substr($PostTime,4,2).".".substr($PostTime,0,4).", ".substr($PostTime,8,2).":".substr($PostTime,10,2).":".substr($PostTime,12,2);
  
$PostHome=urldecode($PostHome);
  
$PostMsg=urldecode($PostMsg);
  
$PostMsg=stripslashes($PostMsg);

  
// *** Smilies ersetzen ***
  
if($smilies_path) {
    
$PostMsg=eregi_replace("(\:\_)(.{1,8})(\_\:)"," <img src=\"".$smilies_path."\\2.gif\" border=\"\" alt=\"\\2\"> ",$PostMsg);
    
$PostMsg=str_replace(":-))","<img src=\"".$smilies_path."happy.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-)","<img src=\"".$smilies_path."smile.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(";-)","<img src=\"".$smilies_path."wink.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-(","<img src=\"".$smilies_path."sad.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace("&gt;:-&gt;","<img src=\"".$smilies_path."devil.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-P","<img src=\"".$smilies_path."puh.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
  }
  
// *** Tags ersetzen ***
  
$PostMsg=eregi_replace("(:)(b|\/b)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(i|\/i)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(u|\/u)(:)","<\\2>",$PostMsg);

  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=570><tr><td id=guestbooktable>";
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td id=guestbooktitle>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%><tr><td id=guestbooktitle width=100%>".$PostName."</td>";
  echo 
"<td id=guestbooktitleinfo nowrap>Eintrag #".$PostNo." vom ".$PostTime." Uhr</td></tr></table>";
  echo 
"</td></tr><tr><td id=guestbooktable><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbookcell><table border=0 cellspacing=0 cellpadding=0 width=100%><tr>";
  echo 
"<td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td></td><td width=100% id=guestbookcell><img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
$PostMsg."<img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
"</td></tr><tr><td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=2 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbooktable colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr></table>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%>";
  echo 
"<tr><td id=guestbookinfo nowrap align=right>E-Mail:</td>";

  if(
$PostMail=="")
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  else{
    
$em=explode("@",$PostMail);
    
$m=str_replace("@"," [at] ",$PostMail);
    
$m=str_replace("."," [dot] ",$m);
    echo 
"<td id=guestbookinfo width=100%><script language=\"javascript\">\n\n</script><noscript>$m</noscript></a></td></tr>";
  }

  echo 
"<tr><td id=guestbookinfo nowrap align=right>Website:</td>";
  if((!
$PostHome) || ($PostHome=="http://")) {
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  } else {
    echo 
"<td id=guestbookinfo width=100%><a href=\"$PostHome\" target=\"_blank\">$PostHome</a></td></tr>";
  }
  echo 
"</table></td></tr></table></td></tr></table>\n\n";
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)){
    echo 
"<b id=red>Admin:[/b] <a href=\"".$PHP_SELF."?action=del&entry=".$OrigTime."\">Posting löschen</a>
\n"
;
  }

}

// ############################################################################

function PrintPostingSpace()
{
  global 
$images_path;
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img src=\"".$images_path."space1.gif\" width=1 height=10 border=0></td></tr></table>\n";
}

// ############################################################################

function DelPosting($data_file,$entry){
  if(!
file_exists($data_file)) return 0;
  
$lines=file($data_file);
  @
unlink($data_file);
  
$fp=fopen($data_file,"w");
  
flock($fp,2);
  foreach(
$lines as $line){
    
$l=explode("|~#~|",$line);
    if((
chop($line)) && ($l[0]!=$entry)) fputs($fp,$line);
  }
  
flock($fp,3);
  
fclose($fp);
  return 
1;
}

?>[/b]
PHP-Code:
<?php
// #####################
// ### Gästebuch 2.2 ###
// #####################

// *********************
// *** Einstellungen ***
// *********************

// Titel des Gästebuchs.
$guestbook_title="Mein Gästebuch";

// Style des Gästebuches ("fire", "grey" oder "gaijin").
// (Die Stylesheet-Datei sollte natürlich an die eigene Seite angepasst werden.)
$guestbook_style="fire";

// Relativer Pfad zu der Datei, in der die Daten gespeichert werden.
$data_file="guestbook.dat";

// Relativer Pfad zum Verzeichnis, in dem sich die Bilder (space1.gif) befinden.
$images_path="images/";

// Relativer Pfad zum Verzeichnis, in dem sich die Smilies befinden.
// Ist kein Pfad angegeben, werden keine Smilies angezeigt.
$smilies_path="images/smilies/";

// Anzahl der Beiträge pro Seite.
$postspersite=10;

// Administration
$AdminLogin="admin";     // BITTE Ã„NDERN!
$AdminPasswd="password"// BITTE Ã„NDERN!

// *********************

function AuthUser() {
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;
  if((!isset(
$PHP_AUTH_USER)) || (!isset($PHP_AUTH_PW)) || ($PHP_AUTH_USER!=$AdminLogin) || ($PHP_AUTH_PW!=$AdminPasswd)){
    
header('WWW-Authenticate: Basic realm="Gaijins Guestbook - Administration"');
    
header('HTTP/1.0 401 Unauthorized');
    echo 
'<html><head></head><body>Authentifizierung erforderlich!

'
;
    echo 
'[url="guestbook.php"]Zurück zum Gästebuch[/url]
</body></html>'
;
    exit;
  }
}

if(
$go=="login") {
  
AuthUser();
}

if(
$go=="del") {
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)) {
    
DelPosting($data_file,$entry);
  }
}

// **************************************************************************
?>







<table border=0 cellspacing=0 cellpadding=0><tr><td>

<center>
<h1><?echo $guestbook_title?></h1>

<h2>Neuen Eintrag hinzufügen</h2>
</center>

<table border="0" cellspacing="0" cellpadding="1"><tr><form action="guestbook_post.php" method="post" name="guestbook"><td id="guestbooktable">
<table border="0" cellspacing="0" cellpadding="5"><tr><td id="guestbookinfo">

<?php
if(($send=="1") && trim($err_text!="")) {
  echo 
"

<big>[b]Fehler:<b>

Damit es sich an den Skin anpasst, hab ich den kompletten <head> </head> und die body tags rausgenommen, und das Javascript in meine head.php von dem jeweiligen Skin gesetzt.

Soweit, so gut, denn zumindest wird die Frontpage vom Gästebuch im Design des jeweiligen Skins angezeigt... doch mehr auch leider nicht, denn wenn ich auf "
Neuen Eintrag" klicke, dann ging es nicht.

Also hab ich einen Freund gefragt ob er mir da irgendwas machen könne...

Daraufhin hat er die eine guestbook.php in drei Teile geteilt:

Einmal für den neuen Gästebucheintrag (guestbook_new.php)

</b></big>
"
;
  echo 
"<span id=red>$err_text</span></p>";
}
if(
trim($gb_home=="") && (!$gb_home)) $gb_home="http://";
?>

<table border=0 cellspacing=2 cellpadding=0 width=100%><tr>
<td valign=top>
<table border=0 cellspacing=2 cellpadding=0 width=100%>
<tr><td nowrap align=right id="guestbookinfo">Dein Name:</td><td nowrap align=right id="guestbookinfo"></td>
<td width=100%><input type="text" name="gb_name" size=50 maxlength=25 value="<?php echo $gb_name ?>"></td></tr>
<tr><td nowrap align=right id="guestbookinfo">Deine E-Mail-Adresse: <span id=red>[b]*[/b]</span></td><td></td>
<td width=100%><input type="text" name="gb_mail" size=50 maxlength=50 value="<?php echo $gb_mail ?>"></td></tr>
<tr><td nowrap align=right id="guestbookinfo">Deine Homepage: <span id=red>[b]*[/b]</span></td><td></td>
<td width=100%><input type="text" name="gb_home" size=50 maxlength=65 value="<?php echo $gb_home ?>"></td></tr>
<tr><td nowrap align=right valign=top id="guestbookinfo">Text:
[i](max. 1.000 Zeichen,
keine HTML-Tags)[/i]</td><td></td>
<td width=100%><textarea cols="50" rows="8" name="gb_text"><?php echo $gb_text ?></textarea></td></tr>
<tr><td id="guestbookinfo"><span id=red>[b]*[/b]</span>[i] = optionale Felder[/i]</td><td></td><td>
<input type="hidden" value="1" name="send">
<input type="submit" value="Senden" name="submit">
<input type="reset" value="Zurücksetzen" name="reset">
</td></tr>
</table>
</td><td></td><td width=100% valign=top id="guestbookinfo">
<?php
if($smilies_path) {
?>
[b]SMILIES:[/b]

[img]<?php echo $images_path?>space1.gif[/img]

[img]<?php echo $smilies_path?>smile.gif[/img]
[img]<?php echo $smilies_path?>wink.gif[/img]
[img]<?php echo $smilies_path?>happy.gif[/img]
[img]<?php echo $smilies_path?>sad.gif[/img]
[img]<?php echo $smilies_path?>puh.gif[/img]
[img]<?php echo $smilies_path?>yummie.gif[/img]
[img]<?php echo $smilies_path?>coool.gif[/img]

[img]<?php echo $smilies_path?>pukey.gif[/img]
[img]<?php echo $smilies_path?>devil.gif[/img]:->" onclick="javascript:add_smilie('devil');">
[img]<?php echo $smilies_path?>frown.gif[/img]
[img]<?php echo $smilies_path?>redface.gif[/img]
[img]<?php echo $smilies_path?>clown.gif[/img]
[img]<?php echo $smilies_path?>cry.gif[/img]
[img]<?php echo $smilies_path?>idea.gif[/img]

[img]<?php echo $smilies_path?>cwink.gif[/img]
[img]<?php echo $smilies_path?>grrr.gif[/img]
[img]<?php echo $smilies_path?>ill.gif[/img]
[img]<?php echo $smilies_path?>tooth.gif[/img]
[img]<?php echo $smilies_path?>psycho.gif[/img]
[img]<?php echo $smilies_path?>monster.gif[/img]
[img]<?php echo $smilies_path?>halt.gif[/img]

[img]<?php echo $smilies_path?>glass.gif[/img]
[img]<?php echo $smilies_path?>seek.gif[/img]
[img]<?php echo $smilies_path?>super.gif[/img]
[img]<?php echo $smilies_path?>help.gif[/img]
[img]<?php echo $smilies_path?>boxer.gif[/img]

[img]<?php echo $smilies_path?>dance.gif[/img]
[img]<?php echo $smilies_path?>alcohol.gif[/img]

[img]<?php echo $images_path?>space1.gif[/img]

<?php
//}
?>
[b]TAGS:[/b]

[img]<?php echo $images_path?>space1.gif[/img]


<table border=0 cellspacing=0 cellpadding=0
<tr><td id="guestbookinfo" align="center"><b id="red">:b:
[/b]
PHP-Code:
</td><td id="guestbookinfo" align="center">bzw.</td><td id="guestbookinfo" align="center"><b id="red">:/b:[/b]</td><td id="guestbookinfo">für [b]fett[/b]</tr>
<tr><td id="guestbookinfo" align="center"><b id="red">:i:[/b]</td><td id="guestbookinfo" align="center">bzw.</td><td id="guestbookinfo" align="center"><b id="red">:/i:[/b]</td><td id="guestbookinfo">für [i]kursiv[/i]</tr>
<tr><td id="guestbookinfo" align="center"><b id="red">:u:[/b]</td><td id="guestbookinfo" align="center">bzw.</td><td id="guestbookinfo" align="center"><b id="red">:/u:[/b]</td><td id="guestbookinfo">für <u>unterstrichen</u></tr>
</table>

</td>
</tr></table>

</td></tr></table>
</td></form></tr></table>

<center>


<big>[b][url="index.php?action=guestbook"]Zurück zum Gästebuch[/url][/b]</big>



<table border=0 cellspacing=0 cellpadding=0 width=570><tr><td id=guestbooktable>[img]space1.gif[/img]</tr></td></table>

[b]Powered by

[url="http://www.gaijin.at/"]www.gaijin.at[/url][/b]
</center>

</td></tr></table>
</body>
</html>

<?php
exit;
}
?>

<center>


<table border=0 cellspacing=0 cellpadding=0 width=570><tr><td id=guestbooktable>[img]space1.gif[/img]</tr></td></table>

Administration: [b][url="index.php?go=guestbook_login"]Login[/url][/b]



[b]Powered by

[url="http://www.gaijin.at/"]www.gaijin.at[/url][/b]
</center>

</td></tr></table>

<?php


// ############################################################################

function PrintPosting($PostNo,$PostName,$PostMail,$PostHome,$PostTime,$PostMsg)
{
  global 
$smilies_path;
  global 
$images_path;
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;

  
$OrigTime=$PostTime;
  
$PostTime=substr($PostTime,6,2).".".substr($PostTime,4,2).".".substr($PostTime,0,4).", ".substr($PostTime,8,2).":".substr($PostTime,10,2).":".substr($PostTime,12,2);
  
$PostHome=urldecode($PostHome);
  
$PostMsg=urldecode($PostMsg);
  
$PostMsg=stripslashes($PostMsg);

  
// *** Smilies ersetzen ***
  
if($smilies_path) {
    
$PostMsg=eregi_replace("(\:\_)(.{1,8})(\_\:)"," <img src=\"".$smilies_path."\\2.gif\" border=\"\" alt=\"\\2\"> ",$PostMsg);
    
$PostMsg=str_replace(":-))","<img src=\"".$smilies_path."happy.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-)","<img src=\"".$smilies_path."smile.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(";-)","<img src=\"".$smilies_path."wink.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-(","<img src=\"".$smilies_path."sad.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace("&gt;:-&gt;","<img src=\"".$smilies_path."devil.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-P","<img src=\"".$smilies_path."puh.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
  }
  
// *** Tags ersetzen ***
  
$PostMsg=eregi_replace("(:)(b|\/b)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(i|\/i)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(u|\/u)(:)","<\\2>",$PostMsg);

  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=570><tr><td id=guestbooktable>";
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td id=guestbooktitle>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%><tr><td id=guestbooktitle width=100%>".$PostName."</td>";
  echo 
"<td id=guestbooktitleinfo nowrap>Eintrag #".$PostNo." vom ".$PostTime." Uhr</td></tr></table>";
  echo 
"</td></tr><tr><td id=guestbooktable><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbookcell><table border=0 cellspacing=0 cellpadding=0 width=100%><tr>";
  echo 
"<td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td></td><td width=100% id=guestbookcell><img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
$PostMsg."<img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
"</td></tr><tr><td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=2 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbooktable colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr></table>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%>";
  echo 
"<tr><td id=guestbookinfo nowrap align=right>E-Mail:</td>";

  if(
$PostMail=="")
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  else{
    
$em=explode("@",$PostMail);
    
$m=str_replace("@"," [at] ",$PostMail);
    
$m=str_replace("."," [dot] ",$m);
    echo 
"<td id=guestbookinfo width=100%><script language=\"javascript\">\n\n</script><noscript>$m</noscript></a></td></tr>";
  }

  echo 
"<tr><td id=guestbookinfo nowrap align=right>Website:</td>";
  if((!
$PostHome) || ($PostHome=="http://")) {
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  } else {
    echo 
"<td id=guestbookinfo width=100%><a href=\"$PostHome\" target=\"_blank\">$PostHome</a></td></tr>";
  }
  echo 
"</table></td></tr></table></td></tr></table>\n\n";
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)){
    echo 
"<b id=red>Admin:[/b] <a href=\"".$PHP_SELF."?go=del&entry=".$OrigTime."\">Posting löschen</a>
\n"
;
  }

}

// ############################################################################

function PrintPostingSpace()
{
  global 
$images_path;
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img src=\"".$images_path."space1.gif\" width=1 height=10 border=0></td></tr></table>\n";
}

// ############################################################################

function DelPosting($data_file,$entry){
  if(!
file_exists($data_file)) return 0;
  
$lines=file($data_file);
  @
unlink($data_file);
  
$fp=fopen($data_file,"w");
  
flock($fp,2);
  foreach(
$lines as $line){
    
$l=explode("|~#~|",$line);
    if((
chop($line)) && ($l[0]!=$entry)) fputs($fp,$line);
  }
  
flock($fp,3);
  
fclose($fp);
  return 
1;
}

?>
Für das posten (guestbook_post.php)

PHP-Code:
<?php
// #####################
// ### Gästebuch 2.2 ###
// #####################

// *********************
// *** Einstellungen ***
// *********************

// Titel des Gästebuchs.
$guestbook_title="Mein Gästebuch";

// Style des Gästebuches ("fire", "grey" oder "gaijin").
// (Die Stylesheet-Datei sollte natürlich an die eigene Seite angepasst werden.)
$guestbook_style="fire";

// Relativer Pfad zu der Datei, in der die Daten gespeichert werden.
$data_file="guestbook.dat";

// Relativer Pfad zum Verzeichnis, in dem sich die Bilder (space1.gif) befinden.
$images_path="images/";

// Relativer Pfad zum Verzeichnis, in dem sich die Smilies befinden.
// Ist kein Pfad angegeben, werden keine Smilies angezeigt.
$smilies_path="images/smilies/";

// Anzahl der Beiträge pro Seite.
$postspersite=10;

// Administration
$AdminLogin="admin";     // BITTE Ã„NDERN!
$AdminPasswd="password"// BITTE Ã„NDERN!

// *********************

function AuthUser() {
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;
  if((!isset(
$PHP_AUTH_USER)) || (!isset($PHP_AUTH_PW)) || ($PHP_AUTH_USER!=$AdminLogin) || ($PHP_AUTH_PW!=$AdminPasswd)){
    
header('WWW-Authenticate: Basic realm="Gaijins Guestbook - Administration"');
    
header('HTTP/1.0 401 Unauthorized');
    echo 
'<html><head></head><body>Authentifizierung erforderlich!

'
;
    echo 
'[url="guestbook.php"]Zurück zum Gästebuch[/url]
</body></html>'
;
    exit;
  }
}

if(
$go=="login") {
  
AuthUser();
}

if(
$go=="del") {
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)) {
    
DelPosting($data_file,$entry);
  }
}

// **************************************************************************
?>







<table border=0 cellspacing=0 cellpadding=0><tr><td>

<?php

//if($go=="post")
//{
if(strlen($gb_text)>1000) {
  
$gb_text=substr($gb_text,0,1000)."... (Text wurde gekürzt!)";
}
$gb_name=str_replace(chr(34),"''",$gb_name);
$gb_name=stripslashes($gb_name);
$gb_mail=strtolower(stripslashes($gb_mail));
$gb_home=strtolower(stripslashes($gb_home));
$gb_text=stripslashes(trim($gb_text));

if(
trim($gb_name=="")) $err_text.="Bitte gib Deinen Namen an.
"
;
if(
trim($gb_mail!="")) {
  if(!
ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$",$gb_mail))
    
$err_text.="Bitte gib eine gültige E-Mail-Adresse an (z.B.: [email]vorname.nachname@provider.at[/email]).
"
;
}
if(
trim($gb_home!="") && trim($gb_home!="http://")) {
  if((!
ereg("^http:\/\/(.{3,})\.(.{2,})",$gb_home)) || (ereg("\?",$gb_home)))
    
$err_text.="Bitte gib eine gültige URL an (z.B.: [url]http://www.seite.at/[/url]).
"
;
}

if(
trim($gb_text=="")) $err_text.="Bitte gib einen Text ein.
"
;
//}

?>

<center>


<table border=0 cellspacing=0 cellpadding=0 width=570><tr><td id=guestbooktable>[img]space1.gif[/img]</tr></td></table>

Administration: [b][url="<?php echo $PHP_SELF."]">Login[/url][/b]



[
b]Powered by

[url="http://www.gaijin.at/"]www.gaijin.at[/url][/b]
</
center>

</
td></tr></table>

<?
php


// ############################################################################

function PrintPosting($PostNo,$PostName,$PostMail,$PostHome,$PostTime,$PostMsg)
{
  global 
$smilies_path;
  global 
$images_path;
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;

  
$OrigTime=$PostTime;
  
$PostTime=substr($PostTime,6,2).".".substr($PostTime,4,2).".".substr($PostTime,0,4).", ".substr($PostTime,8,2).":".substr($PostTime,10,2).":".substr($PostTime,12,2);
  
$PostHome=urldecode($PostHome);
  
$PostMsg=urldecode($PostMsg);
  
$PostMsg=stripslashes($PostMsg);

  
// *** Smilies ersetzen ***
  
if($smilies_path) {
    
$PostMsg=eregi_replace("(\:\_)(.{1,8})(\_\:)"," <img src=\"".$smilies_path."\\2.gif\" border=\"\" alt=\"\\2\"> ",$PostMsg);
    
$PostMsg=str_replace(":-))","<img src=\"".$smilies_path."happy.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-)","<img src=\"".$smilies_path."smile.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(";-)","<img src=\"".$smilies_path."wink.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-(","<img src=\"".$smilies_path."sad.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace("&gt;:-&gt;","<img src=\"".$smilies_path."devil.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-P","<img src=\"".$smilies_path."puh.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
  }
  
// *** Tags ersetzen ***
  
$PostMsg=eregi_replace("(:)(b|\/b)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(i|\/i)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(u|\/u)(:)","<\\2>",$PostMsg);

  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=570><tr><td id=guestbooktable>";
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td id=guestbooktitle>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%><tr><td id=guestbooktitle width=100%>".$PostName."</td>";
  echo 
"<td id=guestbooktitleinfo nowrap>Eintrag #".$PostNo." vom ".$PostTime." Uhr</td></tr></table>";
  echo 
"</td></tr><tr><td id=guestbooktable><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbookcell><table border=0 cellspacing=0 cellpadding=0 width=100%><tr>";
  echo 
"<td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td></td><td width=100% id=guestbookcell><img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
$PostMsg."<img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
"</td></tr><tr><td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=2 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbooktable colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr></table>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%>";
  echo 
"<tr><td id=guestbookinfo nowrap align=right>E-Mail:</td>";

  if(
$PostMail=="")
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  else{
    
$em=explode("@",$PostMail);
    
$m=str_replace("@"," [at] ",$PostMail);
    
$m=str_replace("."," [dot] ",$m);
    echo 
"<td id=guestbookinfo width=100%><script language=\"javascript\">\n\n</script><noscript>$m</noscript></a></td></tr>";
  }

  echo 
"<tr><td id=guestbookinfo nowrap align=right>Website:</td>";
  if((!
$PostHome) || ($PostHome=="http://")) {
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  } else {
    echo 
"<td id=guestbookinfo width=100%><a href=\"$PostHome\" target=\"_blank\">$PostHome</a></td></tr>";
  }
  echo 
"</table></td></tr></table></td></tr></table>\n\n";
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)){
    echo 
"<b id=red>Admin:[/b] <a href=\"".$PHP_SELF."?go=del&entry=".$OrigTime."\">Posting löschen</a>
\n"
;
  }

}

// ############################################################################

function PrintPostingSpace()
{
  global 
$images_path;
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img src=\"".$images_path."space1.gif\" width=1 height=10 border=0></td></tr></table>\n";
}

// ############################################################################

function DelPosting($data_file,$entry){
  if(!
file_exists($data_file)) return 0;
  
$lines=file($data_file);
  @
unlink($data_file);
  
$fp=fopen($data_file,"w");
  
flock($fp,2);
  foreach(
$lines as $line){
    
$l=explode("|~#~|",$line);
    if((
chop($line)) && ($l[0]!=$entry)) fputs($fp,$line);
  }
  
flock($fp,3);
  
fclose($fp);
  return 
1;
}

?>
und halt die guestbook.php

PHP-Code:
<?php
// #####################
// ### Gästebuch 2.2 ###
// #####################

// *********************
// *** Einstellungen ***
// *********************

// Titel des Gästebuchs.
$guestbook_title="Mein Gästebuch";

// Style des Gästebuches ("fire", "grey" oder "gaijin").
// (Die Stylesheet-Datei sollte natürlich an die eigene Seite angepasst werden.)
$guestbook_style="fire";

// Relativer Pfad zu der Datei, in der die Daten gespeichert werden.
$data_file="guestbook.dat";

// Relativer Pfad zum Verzeichnis, in dem sich die Bilder (space1.gif) befinden.
$images_path="images/";

// Relativer Pfad zum Verzeichnis, in dem sich die Smilies befinden.
// Ist kein Pfad angegeben, werden keine Smilies angezeigt.
$smilies_path="images/smilies/";

// Anzahl der Beiträge pro Seite.
$postspersite=10;

// Administration
$AdminLogin="admin";     // BITTE Ã„NDERN!
$AdminPasswd="password"// BITTE Ã„NDERN!

// *********************

function AuthUser() {
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;
  if((!isset(
$PHP_AUTH_USER)) || (!isset($PHP_AUTH_PW)) || ($PHP_AUTH_USER!=$AdminLogin) || ($PHP_AUTH_PW!=$AdminPasswd)){
    
header('WWW-Authenticate: Basic realm="Gaijins Guestbook - Administration"');
    
header('HTTP/1.0 401 Unauthorized');
    echo 
'<html><head></head><body>Authentifizierung erforderlich!

'
;
    echo 
'[url="guestbook.php"]Zurück zum Gästebuch[/url]
</body></html>'
;
    exit;
  }
}

if(
$go=="login") {
  
AuthUser();
}

if(
$go=="del") {
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)) {
    
DelPosting($data_file,$entry);
  }
}

// **************************************************************************
?>







<table border=0 cellspacing=0 cellpadding=0><tr><td>

<?php
// **************************
// *** Gästebuch anzeigen ***
// **************************

if(!isset($first)) $first=0;
// *** Zu langen Text abschneiden ***
$first=abs(substr($first,0,5));

// *** Wenn Posting "gesendet" wurde und kein Fehlertext ausgegeben wurde ***
if(($send=="1") && trim($err_text=="")) {
  
$gb_date=date("YmdHis"); // *** Datum setzen ***
  
$line=file($data_file); // *** Daten in Array einlesen ***
  
rsort($line);  // *** Array in umgekehrter Reihenfolgen sortieren ***

  
$gb_name=str_replace("<","&lt;",$gb_name);
  
$gb_name=str_replace(">","&gt;",$gb_name);
  
$gb_name=str_replace("\"","&quot;",$gb_name);
  
$gb_name=str_replace("~","-",$gb_name);
  
$gb_name=str_replace("  "," ",$gb_name);
  
$gb_name=strip_tags($gb_name,"[b][i]<u><a><img>");

  
$gb_home=ereg_replace("(<|>| |\(|\)|\||\"|\')","",$gb_home);
  
$gb_home=str_replace("~","-",$gb_home);
  
$gb_home=urlencode($gb_home);
  if(
trim($gb_home=="http://")) $gb_home="";

  
$gb_text=str_replace("<","&lt;",$gb_text);
  
$gb_text=str_replace(">","&gt;",$gb_text);
  
$gb_text=str_replace("\"","&quot;",$gb_text);
  
$gb_text=str_replace("~","-",$gb_text);
  
$gb_text=str_replace("  "," ",$gb_text);
  
$gb_text=str_replace("\r\n","
"
,$gb_text);
  
$gb_text=urlencode($gb_text);
  
$gb_text=strip_tags($gb_text,"[b][i]<u><a><img>");

  
// *** Datei Ã¶ffnen und mit neuem Eintrag Ã¼berschreiben ***
  
$fp=fopen($data_file,"w");
  
flock($fp,2);
  
fputs($fp,"$gb_date|~#~|$gb_name|~#~|$gb_mail|~#~|$gb_home|~#~|$gb_text".chr(13).chr(10));

  
// *** Alte Einträge anhängen ***
  
for($i=0;$i<count($line);$i++) {
    
fputs($fp,$line[$i]);
  }
  
flock($fp,3);
  
fclose($fp);

  echo 
"<p id=red><big>[b]Danke für Deinen Eintrag![/b]</big></p>\n";

  
$gb_name="";
  
$gb_mail="";
  
$gb_home="";
  
$gb_text="";
  
$send="";
  
$err_text="";

}

?>

<center>
<h1><?echo $guestbook_title?></h1>
<big>[b][url="index.php?action=guestbook_new"]Neuen Gästebucheintrag hinzufügen[/url][/b]</big>



</center>

<?php

$line
=@file($data_file);

// *** Startwert Ã¼berprüfen und ggf. setzen ***
if($first<0$first=0;
if(
$first>count($line)-1$first=count($line)-1;
// *** Anzahl der Postings/Seite Ã¼berprüfen und ggf. setzen ***
if($postspersite>count($line)) $postspersite=count($line);

// *** Postings nach Startwert und Anzahl/Seite anzeigen ***
for($i=$first;$i<$first+$postspersite;$i++) {
  
$p=explode("|~#~|",$line[$i],5);
  if((isset(
$p[0])) && ($i<count($line))) {
    
PrintPosting(count($line)-$i,$p[1],$p[2],$p[3],$p[0],$p[4]."
\n"
);
    
PrintPostingSpace();
  }
}

if(
$line)
{
  
// *** Navigationslinks generieren ***
  
$i=count($line)+$postspersite;
  
$j=$i;
  echo 
"<center>[b][i]Postings:[/i][/b] ";
  while(
$j>1) {
    
// *** Startwert für Link ***
    
$i-=$postspersite;
    if(
$i<1$i=1;
    
// *** Endwert für Link ***
    
$j=$i-$postspersite+1;
    if(
$j<1$j=1;
    
// *** Umgekehrte Reihenfolge der Postings!!! ;-) ***
    
$k=count($line)-$i;
    
// *** Navigationslinks ausgeben ***
    // *** (funktioniert auch für 1 Posting pro Seite!) ***
    
if($first==$k) {
      if(
$i!=$j) {echo "$i-$j";} else {echo "$i";}
    }else{
      echo 
"<nobr><a href=\"".$PHP_SELF."?first=$k\">";
      if(
$i!=$j) {echo "$i-$j";} else {echo "$i";}
      echo 
"</a>";
    }
    if(
$j>1) echo "|</nobr> ";
  }
  echo 
"</nobr>
</center>\n\n"
;
}

if(
$line)
{
  echo 
"<center>\n";
  echo 
"
\n"
;
  echo 
"<big>[b]<a href=\"index.php?action=new\">Neuen Gästebucheintrag hinzufügen</a>[/b]</big>
\n"
;
  echo 
"</center>\n";
}

?>

<center>


<table border=0 cellspacing=0 cellpadding=0 width=570><tr><td id=guestbooktable>[img]space1.gif[/img]</tr></td></table>

Administration: [b][url="<?php echo $PHP_SELF."]">Login[/url][/b]



[
b]Powered by

[url="http://www.gaijin.at/"]www.gaijin.at[/url][/b]
</
center>

</
td></tr></table>

<?
php


// ############################################################################

function PrintPosting($PostNo,$PostName,$PostMail,$PostHome,$PostTime,$PostMsg)
{
  global 
$smilies_path;
  global 
$images_path;
  global 
$PHP_AUTH_USER;
  global 
$PHP_AUTH_PW;
  global 
$AdminLogin;
  global 
$AdminPasswd;

  
$OrigTime=$PostTime;
  
$PostTime=substr($PostTime,6,2).".".substr($PostTime,4,2).".".substr($PostTime,0,4).", ".substr($PostTime,8,2).":".substr($PostTime,10,2).":".substr($PostTime,12,2);
  
$PostHome=urldecode($PostHome);
  
$PostMsg=urldecode($PostMsg);
  
$PostMsg=stripslashes($PostMsg);

  
// *** Smilies ersetzen ***
  
if($smilies_path) {
    
$PostMsg=eregi_replace("(\:\_)(.{1,8})(\_\:)"," <img src=\"".$smilies_path."\\2.gif\" border=\"\" alt=\"\\2\"> ",$PostMsg);
    
$PostMsg=str_replace(":-))","<img src=\"".$smilies_path."happy.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-)","<img src=\"".$smilies_path."smile.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(";-)","<img src=\"".$smilies_path."wink.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-(","<img src=\"".$smilies_path."sad.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace("&gt;:-&gt;","<img src=\"".$smilies_path."devil.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
    
$PostMsg=str_replace(":-P","<img src=\"".$smilies_path."puh.gif\" border=\"\" alt=\"Smile\">",$PostMsg);
  }
  
// *** Tags ersetzen ***
  
$PostMsg=eregi_replace("(:)(b|\/b)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(i|\/i)(:)","<\\2>",$PostMsg);
  
$PostMsg=eregi_replace("(:)(u|\/u)(:)","<\\2>",$PostMsg);

  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=570><tr><td id=guestbooktable>";
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td id=guestbooktitle>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%><tr><td id=guestbooktitle width=100%>".$PostName."</td>";
  echo 
"<td id=guestbooktitleinfo nowrap>Eintrag #".$PostNo." vom ".$PostTime." Uhr</td></tr></table>";
  echo 
"</td></tr><tr><td id=guestbooktable><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbookcell><table border=0 cellspacing=0 cellpadding=0 width=100%><tr>";
  echo 
"<td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td></td><td width=100% id=guestbookcell><img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
$PostMsg."<img src=\"".$images_path."space1.gif\" width=1 height=6 alt=\"\" border=0>
"
;
  echo 
"</td></tr><tr><td colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=2 alt=\"\" border=0></td></tr>";
  echo 
"<tr><td id=guestbooktable colspan=2><img src=\"".$images_path."space1.gif\" width=1 height=1 alt=\"\" border=0></td></tr></table>";
  echo 
"<table border=0 cellspacing=0 cellpadding=1 width=100%>";
  echo 
"<tr><td id=guestbookinfo nowrap align=right>E-Mail:</td>";

  if(
$PostMail=="")
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  else{
    
$em=explode("@",$PostMail);
    
$m=str_replace("@"," [at] ",$PostMail);
    
$m=str_replace("."," [dot] ",$m);
    echo 
"<td id=guestbookinfo width=100%><script language=\"javascript\">\n\n</script><noscript>$m</noscript></a></td></tr>";
  }

  echo 
"<tr><td id=guestbookinfo nowrap align=right>Website:</td>";
  if((!
$PostHome) || ($PostHome=="http://")) {
    echo 
"<td id=guestbookinfolight width=100%>[i](Nicht angegeben)[/i]</td></tr>";
  } else {
    echo 
"<td id=guestbookinfo width=100%><a href=\"$PostHome\" target=\"_blank\">$PostHome</a></td></tr>";
  }
  echo 
"</table></td></tr></table></td></tr></table>\n\n";
  if((isset(
$PHP_AUTH_USER)) && (isset($PHP_AUTH_PW)) && ($PHP_AUTH_USER==$AdminLogin) && ($PHP_AUTH_PW==$AdminPasswd)){
    echo 
"<b id=red>Admin:[/b] <a href=\"".$PHP_SELF."?go=del&entry=".$OrigTime."\">Posting löschen</a>
\n"
;
  }

}

// ############################################################################

function PrintPostingSpace()
{
  global 
$images_path;
  echo 
"<table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img src=\"".$images_path."space1.gif\" width=1 height=10 border=0></td></tr></table>\n";
}

// ############################################################################

function DelPosting($data_file,$entry){
  if(!
file_exists($data_file)) return 0;
  
$lines=file($data_file);
  @
unlink($data_file);
  
$fp=fopen($data_file,"w");
  
flock($fp,2);
  foreach(
$lines as $line){
    
$l=explode("|~#~|",$line);
    if((
chop($line)) && ($l[0]!=$entry)) fputs($fp,$line);
  }
  
flock($fp,3);
  
fclose($fp);
  return 
1;
}

?>
So, jetzt kommt zwar wenigstens auf die Seite, wo man sich Ã*ns Gästebuch eintragen soll, aber leider kann man nicht posten.

Wenn ich auf absenden klicke, dann kommt man wieder auf die Hauptseite und das steht oben bei Adresse:

Ich weiß auch gar nicht, warum da jetzt charmenu steht und "Wähle Skin" Weil das hat ja eigentlich gar nix mit meinem Gästebuch zu tun, oder?

Das gleiche Problem beim Absenden hab ich übrigens auch bei meinem Kontaktformular.

Ich hab keine Ahnung was ich machen soll, ich hoffe mir hilft jemand. Das Thema gabs wahrscheinlich schon tausendmal und obwohl ich gesucht hab, hab ich nix gefunden... also bitte... nicht gleich schimpfen...

Ist zwar keine Entschuldigung, aber ich bin ne Blondine

Ciao,

Firithlaith
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 02.01.2005, 20:10  
Gast
 
Beiträge: n/a
Standard

Falls es irgendjemanden interessiert:

Ich hab den kompletten Code vom DropDown Menü rausgenommen und jetzt kann ich zwar wieder absenden, aber eingetragen wird der Post nicht (ja ich hab CHMODS gesetzt) und ich komme zu ner Seite wo man ins Admin Menü rein kann, aber selbst das geht nicht
 
Alt 02.01.2005, 20:55  
Gast
 
Beiträge: n/a
Standard

sorry, aber so wir dir bestimmt nicht gehoflen!
du postes hier einiges an code, wobei das meiste davon bestimmt unnötig ist!

schau mal nach ob es irgendwo einen support für dein gb gibt, z.b auf der homepage der ersteller
 
Alt 02.01.2005, 22:04  
Gast
 
Beiträge: n/a
Standard

Danke es funktioniert jetzt

Problem hat sich erledigt!
 
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Erledigt] Galerie Problem... coraplanet PHP Tipps 2008 4 06.06.2008 13:42
Sessions Problem StephenKing PHP Tipps 2008 3 16.10.2007 08:30
datensätze defekt oder problem mit dem einlesen? Ministry Datenbanken 4 06.07.2006 18:42
problem!!! PHP Tipps 2006 6 08.02.2006 11:06
[Erledigt] wieder ein Problem bei phpmailer und smtp PHP Tipps 2006 24 07.02.2006 01:07
[Erledigt] Problem bei Massenmails versenden mit der Funktion mail PHP-Fortgeschrittene 3 19.01.2005 13:36
[Erledigt] Problem mit Übergabe einer Klasse in PHP4 PHP-Fortgeschrittene 10 08.01.2005 21:00
Problem mit Weiterleitung PHP Tipps 2004-2 16 22.12.2004 17:49
Smarty und PHP-Skript Problem PHP Tipps 2004-2 2 03.12.2004 22:27
[Erledigt] PHP Upload (Master Value/Local Value Problem) PHP-Fortgeschrittene 5 23.11.2004 07:21
Problem mit alter JavaScript-Funktion woods PHP Tipps 2004 1 13.08.2004 13:34
[Erledigt] Problem mit Timestamp! PHP Tipps 2004 24 08.06.2004 19:51
Login Problem PHP Tipps 2004 4 04.06.2004 18:46
foreach problem mAy^daY PHP Tipps 2004 3 02.06.2004 20:29

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
gaijin guestbook admin login, delposting php, gästebuch gb fire grey, gaijin.at gäste buch adim login daten, gaijin guestbook 2.2, gaijin guestbook bearbeiten, gaijin gästebuch style, gajin gästebuch style, http authentifizierung gaijin gästebuch, gaijin gästebuch admin zugang, center/gästebuch, gaijin guestbook - administration, gaijin gästebuch login, gaijin guestbook - administration\, insertmailgb

Alle Zeitangaben in WEZ +2. Es ist jetzt 13:06 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.