Newsgroup: it.comp.www.php
Titolo: aiuto su guest book...

Salve a tutti,
ma secondo voi come mai questo script non funziona correttamente
se aggiungo del codice sopra per personalizzarlo a mio piacimento?
Per non funzionare intendo che non avvisa sui campi obbligatori
o per esempio dopo aver AGGIUNTO un messaggio il browser
mi ritorna una pagina con solo le righe che ho aggiunto io senza
tutto il guest book....
NOTA: echo "ciao"; l'ho scritto io
grazie!
ECCO IL CODICE
<?
echo "ciao";
//
############################################################################
########################
// # JGB (Justice Guestbook) Vers. 1.2
//
############################################################################
########################
// #
// # Administration Loginpage (do not edit this file)
// #
//
############################################################################
########################
// # Copyright © 2001 by Justice Media
// # Contact: 
kon...@justice-media.de
// # Homepage: 
http://www.justice-media.de
//
############################################################################
########################
// # Leave this header in every file !!!
// #
//
############################################################################
########################
// #  Justice Media offers no warranties on this script.
// #  The owner/licensee of the script is
// #  solely responsible for any problems caused by installation of
// #  the script or use of the script, including messages that may be
// #  posted on the JGB.
// #
// #  All copyright notices regarding the Justice Guestbook
// #  must remain intact on the scripts and in the HTML
// #  for the scripts.
// #
// #  For more info on the Justice Guestbook,
// #  see 
http://www.justice-media.de
//
############################################################################
########################
if (file_exists("install.php3")!=0) {
  echo "<center><b>Before you can use the Justice Guestbook, you have to
delete the install.php3 and update.php3 file.</b><p>";
  echo "NOTICE, just delete these files, if you have run the install or
update-script!!!!</center>";
  die;
}
require("globalfuncs.php3");
if(!isset($action)) {
    include("htmlheader.php3");
    $getents = getentries();
    $allentries = $db_sets->num_rows($getents);
    $limit = getsets("postsperpage");
    $getents = getlimitentries($next,$limit);
    $welcometext = getsets("welcome_text");
    echo "<FONT SIZE=\"" . getsets("fontheader") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontnormalcolor") . "\">".
nl2br($welcometext) ."</FONT><p>&nbsp;";
    echo "<table border=0 cellpadding=4 border=0 cellspacing=1 width=" .
getsets("tablewidth_gb") . "\n";
    echo "<TR><TD><FONT SIZE=\"" . getsets("fontsmall") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontnormalcolor") . "\">";
    echo "<a href=\"jgb.php3?action=addentry\"><b>" .
getsets("addentrylink_text") . "</b></a></font></TD>\n";
    echo "<TD align=center>\n";
    echo "<FONT SIZE=\"" . getsets("fontsmall") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontnormalcolor") . "\"><b>"
. getsets("totalentries_text") . "
$allentries&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".
getsets("pages_text") ." ";
    //show pages of jgb
    for($pages = 0;$pages<$allentries/$limit;$pages++) {
         $next = $pages * $limit;
         $page = $pages + 1;
         echo "<a href=jgb.php3?next=$next>$page</a>&nbsp;&nbsp;";
    }
    echo "</B></FONT></td>\n</tr>\n";
    echo "<tr bgcolor=\"" . getsets("tbheader_bgcolor") . "\">\n";
    echo "<td><B><FONT SIZE=\"" . getsets("fontheader") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontheadercolor") . "\">" .
getsets("name_text") . "</FONT></B></td>\n";
    echo "<td><B><FONT SIZE=\"" . getsets("fontheader") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontheadercolor") . "\">" .
getsets("entry_text") . "</FONT></B></td>\n</tr>\n";
    while($entries = $db_sets->fetch_array($getents)) {
         $id = $entries[id];
         $name = $entries[name];
         $email = $entries[email];
         $homepage = $entries[homepage];
         $location = $entries[location];
         $text = nl2br($entries[entry]);
         $date = $entries[8];
         $text = stripslashes($text);
         $text = nolongwords($text);
         if(getsets("censor") == "1")
            $text = censortext($text);
         if(getsets("smilies") == "1")
            $text = smiletext($text);
         echo "<tr bgcolor=\"" . getsets("tb_bgcolor") . "\">\n";
         echo "<td width=30% valign=top><FONT SIZE=\"" .
getsets("fontnormal") . "\" FACE=\"" . getsets("fontface") . "\" COLOR=\"" .
getsets("fontentrycolor") . "\"><B>$name</b></font><BR>\n";
         echo "<FONT SIZE=\"" . getsets("fontsmall") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\">";
         echo "<B>" . getsets("location_text") . "</B> $location";
         echo "<BR><B>" . getsets("postdate_text") . "</B>
$date<BR></font></td>\n";
         echo "<td valign=top>\n";
         echo "<FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">$text</FONT><HR>";
         echo "<table width=100%>\n";
         echo "<tr>\n";
         echo "<td>\n";
         if($email != "")
             echo "<a href=\"mailto:$email\"><img src=\"" .
getsets("email_graphic") . "\" border=0 alt=\"" . getsets("email_alt") .
"\"></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
         if($homepage != "") {
             $homepage = checkurl($homepage);
             echo "<a href=\"$homepage\" target=_blank><img src=\"" .
getsets("homepage_graphic") . "\" border=0 alt=\"" . getsets("homepage_alt")
. "\"></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
         }
         echo "<a href=\"jgb.php3?action=edit&id=$id\"><img src=\"" .
getsets("edit_graphic") . "\" border=0 alt=\"" . getsets("edit_alt") .
"\"></A>";
         echo "</td>\n";
         echo "<td align=right><a
href=\"jgb.php3?action=showip&id=$id\"><img src=\"img/ip.gif\" border=0
alt=\"IP\"></a></td>\n";
         echo "</tr>\n";
         echo "</table>";
         echo "</td>\n</tr>\n";
    }
    echo "<tr><td height=15 colspan=2>&nbsp;</td></tr>";
    echo "<tr>\n";
    echo "<td colspan=2 align=center><a
href=\"$PHP_SELF?action=addentry\"><img src=\"" .
getsets("addentry_graphic") . "\" border=0 alt=\"" . getsets("addentry_alt")
. "\"></a></td>\n";
    echo "</tr>\n";
    echo "<tr><td colspan=2 align=center>";
    include("cfooter.php3");  //you are not allowed to delete this include
    echo "</td></tr>";
    echo "</table>\n";
    include("htmlfooter.php3");
}
//show addentry
if($action == "addentry") {
    include("htmlheader.php3");
    ?>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function Insertsmile(Which) {
           document.addentry.text.value = document.addentry.text.value +
Which;
    }
    //-->
    </SCRIPT>
   <?
    $spamid = md5(uniqid(rand()));
    $welcometext = getsets("entrytop_text");
    $smilecode = showsmilies();
    echo "<FONT SIZE=\"" . getsets("fontheader") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontnormalcolor") . "\">".
nl2br($welcometext) ."</FONT>";
    if($checkfields == "false") {
        $checkemail = is_email($email);
        if($checkemail == false)
          $emailsigncolor = "<FONT COLOR='#ff0000'><b>";
        if($name == "") {
          $namesigncolor = "<FONT COLOR='#ff0000'><b>";
        }
        if($text == "") {
          $textsigncolor = "<FONT COLOR='#ff0000'><b>";
        }
        echo "<p><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\"><b>" .
getsets("notfilled_text") . "</b></FONT><p>";
    }
    echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\" NAME=\"addentry\">";
    echo "<table border=0 cellpadding=4 border=0 cellspacing=1 width=" .
getsets("tablewidth_reg") . ">";
    echo "<TR bgcolor=\"" . getsets("tbheader_bgcolor") . "\"
align=center>";
    echo "<TD colspan=2><FONT SIZE=\"" . getsets("fontheader") . "\"
FACE=\"" . getsets("fontface") . "\" COLOR=\"" . getsets("fontheadercolor")
. "\"><B>" . getsets("tbentryheader_text") . "</B></FONT></TD>";
    echo "</TR>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">$namesigncolor" . getsets("name_text") . " *</FONT></td>";
    echo "<TD><INPUT TYPE=\"TEXT\" NAME=\"name\" VALUE=\"$name\"
SIZE=20></td>";
    echo "</tr>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">$emailsigncolor" . getsets("email_text") . " *</FONT></td>";
    echo "<td><INPUT TYPE=\"TEXT\" NAME=\"email\" VALUE=\"$email\"
SIZE=20></td>";
    echo "</tr>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\">" .
getsets("homepage_text") . "</FONT></td>";
    echo "<td><INPUT TYPE=\"TEXT\" NAME=\"homepage\" VALUE=\"$homepage\"
SIZE=20></td>";
    echo "</tr>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\">" .
getsets("location_text") . "</FONT></td>";
    echo "<td><INPUT TYPE=\"TEXT\" NAME=\"location\" VALUE=\"$location\"
SIZE=30></td>";
    echo "</tr>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD valign=top><FONT SIZE=\"" . getsets("fontnormal") . "\"
FACE=\"" . getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">$textsigncolor" . getsets("entry_text") . " *</FONT></td>";
    echo "<td><TEXTAREA NAME=\"text\" WRAP=\"VIRTUAL\" ROWS=5
COLS=25>$text</TEXTAREA></td>";
    echo "</tr>";
    if(getsets("smilies") == "1") {
       echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
       echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">Smilies</FONT></td>";
       echo "<td>$smilecode</td>";
       echo "</tr>";
    }
    echo "<tr><td colspan=2 align=left>";
    echo "<P><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontnormalcolor") . "\">* " .
getsets("entryrequire_text") . "</FONT></center>";
    echo "</td></tr>";
    echo "<tr><td height=15 colspan=2>&nbsp;</td></tr>";
    echo "<tr><td colspan=2 align=center>";
    echo "<CENTER><INPUT TYPE=\"SUBMIT\" VALUE=\"" .
getsets("entrysubmit_text") . "\"></CENTER>";
    echo "</td></tr>";
    echo "<tr><td height=15 colspan=2>&nbsp;</td></tr>";
    echo "<tr><td colspan=2 align=center>";
    include("cfooter.php3");  //you are not allowed to delete this include
    echo "</td></tr>";
    echo "<P><INPUT TYPE=\"HIDDEN\" NAME=\"action\" VALUE=\"checkfields\">";
    echo "<P><INPUT TYPE=\"HIDDEN\" NAME=\"spamid\" VALUE=\"$spamid\">";
    echo "</form>";
    echo "</table>\n";
    include("htmlfooter.php3");
}
if($action == "checkfields") {
    $checkemail = is_email($email);
    if($name == "") {
      $checkname = "false";
    }
    if($text == "") {
      $checktext = "false";
    }
    $url = "";
    if($checkname == "false" OR $checktext == "false" OR $checkemail ==
false)  {
        $text = urlencode($text);
        header("location:
jgb.php3?action=addentry&spamid=$spamid&checkfields=false&name=$name&email=$
email&homepage=$homepage&text=$text&location=$location");
    }
    else {
       $ip = $REMOTE_ADDR;
       $host = $REMOTE_HOST;
       $date = date("y-m-d H:i:s");
       $checkspam = checkspam($spamid);
       if(getsets("moderate") == 1)
           $activekey = 1;
       else
           $activekey = 0;
       if($checkspam == "no") {
           $entryinsert_rs = $db_sets->query("INSERT INTO $table_entries
(name,email,homepage,location,entry,ipaddress,hostname,entrydate,active,spam
id) VALUES
('$name','$email','$homepage','$location','$text','$ip','$hostname','$date',
'$activekey','$spamid')");
           if(getsets("emailtomaster") == 1) {
emailtomaster($name,$email,$homepage,$location,$text,$ip,$hostname,$date);
           }
           if(getsets("emailtouser") == 1) {
emailtouser($name,$email,$homepage,$location,$text,$ip,$hostname,$date);
           }
       }
       header ("location: jgb.php3?action=thankyou");
    }
}
if($action == "thankyou") {
    include("htmlheader.php3");
    echo "<FONT SIZE=\"" . getsets("fontheader") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontnormalcolor") . "\">";
    echo "<p>&nbsp;<center>" . nl2br(getsets("thankyou_text")) . "";
    echo "<p><b><a href=\"jgb.php3\">" . getsets("backtogb_text") .
"</a></center></b></FONT><p>&nbsp;";
    include("cfooter.php3");  //you are not allowed to delete this include
    include("htmlfooter.php3");
}
//edit or delete entry from guestbook
if($action == "edit") {
    include("htmlheader.php3");
    $getentry_rs = getoneentry($id);
    $getentry = $db_sets->fetch_array($getentry_rs);
    $text = $getentry[entry];
    echo "<form method=post action=\"$PHP_SELF\">";
    echo "<input type=hidden name=action value=editentry>";
    echo "<input type=hidden name=id value=$id>";
    echo "<table border=0 cellpadding=4 border=0 cellspacing=1 width=" .
getsets("tablewidth_gb") . "\n";
    echo "<tr>\n";
    echo "<TD colspan=2 bgcolor=\"" . getsets("tbheader_bgcolor") .
"\"><FONT SIZE=\"" . getsets("fontheader") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontheadercolor") .
"\"><B>Bearbeite oder lösche die Nachricht</B></FONT></TD>";
    echo "</TR>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD colspan=2><input type=checkbox name=delete>&nbsp;";
    echo "<FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\"><b>Nachricht löschen!?!</b> Um die Nachricht zu löschen, einfach
Checkbox klicken.</FONT></td>";
    echo "</tr>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\">Admin
Benutzername</FONT></td>";
    echo "<TD><INPUT TYPE=\"TEXT\" NAME=\"username\" VALUE=\"\"
SIZE=20></td>";
    echo "</tr>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\">Admin
Passwort</FONT></td>";
    echo "<TD><INPUT TYPE=\"PASSWORD\" NAME=\"password\" VALUE=\"\"
SIZE=20></td>";
    echo "</tr>";
    echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
    echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">Bearbeitbare Nachricht</FONT></td>";
    echo "<td><TEXTAREA NAME=\"text\" WRAP=\"VIRTUAL\" ROWS=8
COLS=30>$text</TEXTAREA></td>";
    echo "</tr>";
    echo "<tr><td height=15 colspan=2>&nbsp;</td></tr>";
    echo "<tr><td colspan=2 align=center>";
    echo "<p><CENTER><INPUT TYPE=\"SUBMIT\" VALUE=\"Do it!\"></CENTER>";
    echo "</td></tr>";
    echo "<tr><td height=15 colspan=2>&nbsp;</td></tr>";
    echo "<tr><td colspan=2 align=center>";
    include("cfooter.php3");   //you are not allowed to delete this include
    echo "</td></tr>";
    echo "</table>\n";
    include("htmlfooter.php3");
}
if($action == "showip") {
    include("htmlheader.php3");
    echo "<form method=post action=\"$PHP_SELF\">";
    echo "<input type=hidden name=action value=showip>";
    echo "<input type=hidden name=id value=$id>";
    echo "<table border=0 cellpadding=4 border=0 cellspacing=1 width=" .
getsets("tablewidth_gb") . "\n";
    echo "<tr>\n";
    echo "<TD colspan=2 bgcolor=\"" . getsets("tbheader_bgcolor") .
"\"><FONT SIZE=\"" . getsets("fontheader") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontheadercolor") .
"\"><B>IP-Adresse anzeigen</B></FONT></TD>";
    echo "</TR>";
    if($username == $adminusername && $password == $adminuserpass) {
        $getentry_rs = getoneentry($id);
        $getentry = $db_sets->fetch_array($getentry_rs);
        $ip = $getentry[ipaddress];
        $date = $getentry[8];
        echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
        echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">IP-Adresse: $ip</FONT></td>";
        echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") .
"\">Eintrag vom: $date</FONT></td>";
        echo "</tr>";
    }
    else {
        echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
        echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\">Admin
Benutzername:</FONT></td>";
        echo "<TD><INPUT TYPE=\"TEXT\" NAME=\"username\" VALUE=\"\"
SIZE=20></td>";
        echo "</tr>";
        echo "<TR bgcolor=\"" . getsets("tb_bgcolor") . "\">";
        echo "<TD><FONT SIZE=\"" . getsets("fontnormal") . "\" FACE=\"" .
getsets("fontface") . "\" COLOR=\"" . getsets("fontentrycolor") . "\">Admin
Passwort:</FONT></td>";
        echo "<TD><INPUT TYPE=\"password\" NAME=\"password\" VALUE=\"\"
SIZE=20></td>";
        echo "</tr>";
        echo "<tr><td height=15 colspan=2>&nbsp;</td></tr>";
        echo "<tr><td colspan=2 align=center>";
        echo "<p><CENTER><INPUT TYPE=\"SUBMIT\" VALUE=\"IP
anzeigen!\"></CENTER>";
        echo "</td></tr>";
    }
    echo "<tr><td height=15 colspan=2>&nbsp;</td></tr>";
    echo "<tr><td colspan=2 align=center>";
    echo "<a href=\"jgb.php3\"><FONT SIZE=\"" . getsets("fontsmall") . "\"
FACE=\"" . getsets("fontface") . "\">Zurück zum Gästebuch</FONT></a><p>";
    include("cfooter.php3");   //you are not allowed to delete this include
    echo "</td></tr>";
    echo "</table>\n";
    include("htmlfooter.php3");
}
if($action == "editentry") {
    if($username == $adminusername && $password == $adminuserpass) {
        if(isset($delete))
            $entryedit_rs = $db_sets->query("DELETE FROM $table_entries
WHERE id='$id'");
        else
            $entryedit_rs = $db_sets->query("UPDATE $table_entries SET entry
= '$text' WHERE id = '$id'");
    }
    header("location: jgb.php3");
}
?>


[.....]
Che errore ti da?

Ciao.
Non ho controllato il tuo codice ma da quello che dici è
probabile che da qualke parte il codice richiami un header
di pagina per fare un redirect... facendo dell'output (il tuo echo 
"ciao") prima del redirect gli spari l'header e quindi l'ipotetico
redirect non può + venire effettuato....
se cosi stanno le cose
inizia e fare gli eco solo dopo i vari
header("location: ....  ");


 ha scritto nel messaggio
news:kFOc9.140648$n04.3...@twister2.libero.it...

grazie 1000000000000!
ora funziona!!!
avevi proprio ragione
grazie ancora
ringo

 ringo
era un problema da FAQ:
La mia pagina da l'errore: Can't add header information!
http://php.dopoil.com/faq.php?cantAddHeader
nota:
puoi usare gli echo anche prima delle funzioni header, xò devi bufferizzare 
l'output con le funzioni di output buffering
ob_start() ob_end_flush() ecc (vedi manuale ufficiale)
ciao
-- 
Punkarruso
mail:punkarruso chiocchiolona despammed punto com
pubblicità progresso:
http://www.gnu.org/press/2002-04-11-ms-patent.html