php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19451 Fucking Guestbook!, Please help me, It's very important for me
Submitted: 2002-09-17 07:35 UTC Modified: 2012-05-15 12:28 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: ikez2605 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.2.3 OS: Win 98 SE
Private report: No CVE-ID: None
 [2002-09-17 07:35 UTC] ikez2605 at gmail dot com
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="kazworks@t-online.de";
     $subject="Neuer Eintrag im Gaestebuch";
     $header="From: webmaster@kazworks.net\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="into@poe.de" 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>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-17 07:36 UTC] derick@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.
 [2002-09-17 07:37 UTC] kazworks at t-online dot de
.
 [2002-09-17 07:40 UTC] derick@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.


 [2012-05-15 12:11 UTC] ikez2605 at gmail dot com
-: kazworks@t-online.de +: ikez2605 at gmail dot com
 [2012-05-15 12:17 UTC] pajoye@php.net
-Status: +Status: Open -Block user comment: No +Block user comment: Yes
 [2012-05-15 12:28 UTC] pajoye@php.net
.
 [2012-05-15 12:28 UTC] pajoye@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC