From:             [EMAIL PROTECTED]
Operating system: Win 98 SE
PHP version:      4.2.3
PHP Bug Type:     *General Issues
Bug description:  Fucking Guestbook!

Look here, this is the sourcetext of my guestbook, but if i tried to use,
there is the notice:

Undefined variable 'message'

 !Sorry for my bad English!


<?php
if(isset($GuestbookNew)){
  //Das Formular der Datei guestbook_new.php wurde ausgefüllt und
abgeschickt

  //HTML- und PHP-Tags aus den Eingabefeldern entfernen
  $name=strip_tags($name);
  $email=strip_tags($email);
  $homepage=strip_tags($homepage);
  $eintrag=strip_tags($eintrag);

  //Konvertiere Zeilenumbrüche in HTML-<br>-Umbrüche
  $eintrag=nl2br($eintrag);

  //Eingaben überprüfen
  if(strlen($name)<3){
  //Kein richtiger Name eingegeben
  $error_msg="Bitte geben Sie Ihren Namen an";
  }
  if(strlen($eintrag)<3){
  //Kein Eintrag vorgenommen
  $error_msg.="<br>Bitte geben Sie auch etwas in das Gästebuch ein.";
  }
 
if(ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$",$email)){

  //Mailadresse korrekt angegeben - Name entsprechend formatieren
  $name="<a href=mailto:"; . $email . ">" . $name . "</a>";
  }
  if(ereg("^([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$",$homepage)){
  //Es wurde auch eine Homepageadresse angegeben - entsprechende
Formatierung vornehmen
  if(!ereg("^http:////",$homepage)){
    //http:// fehlt in der Angabe der Adresse - hier ergänzen
    $homepage="http://"; . $homepage;
    }
  $hp_format="<br>Homepage: <a href=" . $homepage . " target='_new'>" .
$homepage . "</a>";
  }
  //Ende Eingaben überprüfen

  if(isset($error_msg)){
  //Fehlerhafte Angaben - Hinweis ausgeben und keinen Eintrag vornehmen
     $message ="<br>Ihr Eintrag konnte leider nicht in unser Gästebuch
aufgenommen werden:<br>";
     $message.=$error_msg;
     $message.="<br>Klicken Sie auf <a
href=javascript:history.back(1)>zurück</a>.<br><br>";

      }else{

     //Neuen Gästebucheintrag vornehmen
     //Neuen Gästebucheintrag formatieren
     $new_entry ="<table width='400' border='0' cellspacing='1'
cellpadding='1'>\n";
     $new_entry.="  <tr valign='top' >\n";
     $new_entry.="    <td class='kleiner' width='300'>Name: " . $name .
$hp_format . "</td>\n";
     $new_entry.="    <td class='kleiner' width='100'>" . date("d.m.Y
H:i") . "</td>\n";
     $new_entry.="  </tr>\n";
     $new_entry.="  <tr valign='top'>\n";
     $new_entry.="    <td colspan='2' class='kleiner'>\n";
     $new_entry.="      <p>" . $eintrag . "</p>\n";
     $new_entry.="    </td>\n";
     $new_entry.="  </tr>\n";
     $new_entry.="  <tr>\n";
     $new_entry.="    <td colspan='2'>\n";
     $new_entry.="      <hr width='400' size='1' noshade>\n";
     $new_entry.="    </td>\n";
     $new_entry.="  </tr>\n";
     $new_entry.="</table>\n";

     $guestfile="guestbook_data.html";

     //Zuerst alte Einträge auslesen
     if(file_exists($guestfile)) {
       $fp=fopen($guestfile,"r");
       $guest_data=fread($fp,filesize($guestfile));
       fclose($fp);
     }

     //Gästebucheinträge neu anlegen und den neuen an den Beginn
schreiben
     $fp=fopen($guestfile,"w");
     flock($fp,1);
     fputs($fp,$new_entry);
     if(isset($guest_data))  fputs($fp,$guest_data);
     flock($fp,3);
     fclose($fp);

     //Mail verschicken
     $recipient="[EMAIL PROTECTED]";
     $subject="Neuer Eintrag im Gaestebuch";
     $header="From: [EMAIL PROTECTED]\n";
     $mail_body="Neuer Eintrag im Gaestebuch";

     mail($recipient,$subject,$mail_body,$header);

  }
}
?>
<?php echo $message; ?>
<?php include("guestbook_data.html") ?>
<link rel="stylesheet" href="../../css/standard.css" type="text/css">

P.S If you want to help me, you will need the files guestbook_data.html
and guestbook_new.php,
guestbook_data.html is a empty .html-file,
and here is the source text of guestbook_new.php:

<link rel="stylesheet" href="../../css/standard.css" type="text/css">
<br>
<center><img src="../../imgs/gbuch.gif" border="0" alt=""></center>
<br>
<form action=guestbook_simple.php method=POST>
<table align="center">
<tr>
 <td>
<font size="-2">Name :</font>
<br>
<font size="-2">E-Mail :</font>
<br>
<font size="-2">Homepage :</font>
 </td>
 <td>
<input value="intotzu" style="border:
none;background-color:#e7e7e7;font-size:7pt; font-family:tahoma;"
type="text" name="name" size="20" maxlength="50">
<br>
<input value="[EMAIL PROTECTED]" style="border:
none;background-color:#e7e7e7;font-size:7pt; font-family:tahoma;"
type="text" name="email" size="20" maxlength="50">
<br>
<input value="www.poe.de" style="border:
none;background-color:#e7e7e7;font-size:7pt; font-family:tahoma;"
type="text" name="homepage" size="30" maxlength="100">
 </td>
</tr>
<tr>
 <td colspan="2">
 <font size="-2">Kommentar :</font><br><br><textarea style="border:
none;background-color:#e7e7e7;font-size:7pt; font-family:tahoma;"
name="eintrag" cols="66" rows="10" >itschoritly</textarea>
 </td>
</tr>
<tr>
<td valign="bottom" align="center" colspan="2">
 <input style="background-color:white; border: none; COLOR: black;
font-size:7pt; font-family:tahoma;" type="Submit" name="GuestbookNew"
value="Eintragen">
</td>
</tr>
</table>
</form>
-- 
Edit bug report at http://bugs.php.net/?id=19451&edit=1
-- 
Try a CVS snapshot:  http://bugs.php.net/fix.php?id=19451&r=trysnapshot
Fixed in CVS:        http://bugs.php.net/fix.php?id=19451&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=19451&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=19451&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=19451&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19451&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=19451&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=19451&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=19451&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=19451&r=globals

Reply via email to