If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
Getting errors when adding comments  XML
Forum Index » Support Forum
Author Message
Anonymous



Hello;

Can someone please help...

Getting the following errors:

When entering Admin following error appears at the top:

Warning: Cannot modify header information - headers already sent by (output started at /home/rincon/public_html/guestbook/lang/spanish.php:107) in /home/rincon/public_html/guestbook/lib/admin.class.php on line 36

When trying to add a comment followin error comes up:

Warning: Cannot modify header information - headers already sent by (output started at /home/rincon/public_html/guestbook/lang/spanish.php:107) in /home/rincon/public_html/guestbook/lib/comment.class.php on line 175

I have done a search but could not find anything regarding these specific errors, Can some one tell me how I can fix this? would appreciate your help. Thank you
ET
Graduate

Joined: 21/02/2003 22:17:48
Messages: 179
Offline

Nelson wrote:
When entering Admin following error appears at the top:

Warning: Cannot modify header information - headers already sent by (output started at /home/rincon/public_html/guestbook/lang/spanish.php:107) in /home/rincon/public_html/guestbook/lib/admin.class.php on line 36
------
Warning: Cannot modify header information - headers already sent by (output started at /home/rincon/public_html/guestbook/lang/spanish.php:107) in /home/rincon/public_html/guestbook/lib/comment.class.php on line 175


Have you recently edited any of these files?

Per Amber222:
Make sure there are no blank lines before or after the code or at the end of the document. Many html and text editors will insert blank lines, which I why I edit files in my ftp program or CPanel's File Manager. Note: An ftp program that does not have its own editor but uses Notepad may also cause this problem.
http://proxy2.de/forum/viewtopic.php?p=13139&highlight=#13139

---------------
Anonymous



Hi Amber,

Thanks for your help...This is the script in my public_html/guestbook/lib/admin.class.php... file..can you see any problems here?

<?php
/**
* ----------------------------------------------
* Advanced Guestbook 2.3.1 (PHP/MySQL)
* Copyright (c)2001 Chi Kien Uong
* URL: http://www.proxy2.de
* ----------------------------------------------
*/

class gb_admin {

var $db;
var $session;
var $SELF;
var $uid;
var $VARS;
var $table;

function gb_admin($session,$uid) {
global $HTTP_SERVER_VARS;
$this->session = $session;
$this->uid = $uid;
$this->SELF = basename($HTTP_SERVER_VARS["PHP_SELF"]);
}

function get_updated_vars() {
$this->db->query("SELECT * FROM ".$this->table['cfg']);
$this->VARS = $this->db->fetch_array($this->db->result);
$this->db->free_result($this->db->result);
}

function NoCacheHeader() {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}

function show_panel($panel) {
global $smilie_list, $smilie_data;
$this->NoCacheHeader();
include_once "./admin/panel_$panel.php";
include_once "./admin/footer.inc.php";
}

function scan_smilie_dir() {
$smilies = '';
chdir("./img/smilies");
$hnd = opendir(".");
while ($file = readdir($hnd)) {
if(is_file($file)) {
if ($file != "." && $file != "..") {
if (ereg(".gif|.jpg|.png|.jpeg",$file)) {
$smilie_list[] = $file;
}
}
}
}
closedir($hnd);
if (isset($smilie_list)) {
asort($smilie_list);
for ($i=0;$i<sizeof($smilie_list);$i++) {
$size = GetImageSize($smilie_list[$i]);
if (is_array($size)) {
$smilies[$smilie_list[$i]] = "<img src=\"img/smilies/$smilie_list[$i]\" $size[3]>";
}
}
}
chdir("../../");
return $smilies;
}

function show_entry($tbl="gb") {
global $entry, $record, $GB_UPLOAD;
if ($tbl=="priv") {
$gb_tbl = $this->table['priv'];
$book_id = 1;
} else {
$gb_tbl = $this->table['data'];
$tbl="gb";
$book_id = 2;
}
$entries_per_page = $this->VARS["entries_per_page"];
if(!isset($entry)) {
$entry = 0;
}
if(!isset($record)) {
$record = 0;
}
$next_page = $entry+$entries_per_page;
$prev_page = $entry-$entries_per_page;
$this->db->query("select count(*) total from $gb_tbl");
$this->db->fetch_array($this->db->result);
$total = $this->db->record['total'];
if ($record > 0 && $record <= $total) {
$entry = $total-$record;
$next_page = $entry+$entries_per_page;
$prev_page = $entry-$entries_per_page;
}
$result = $this->db->query("select x.*, y.p_filename, y.width, y.height from $gb_tbl x left join ".$this->db->table['pics']." y on (x.id=y.msg_id and y.book_id=$book_id) order by id desc limit $entry, $entries_per_page");
$img = new gb_image();
$img->set_border_size($this->VARS["img_width"], $this->VARS["img_height"]);
$this->NoCacheHeader();
include_once "./admin/panel_easy.php";
include_once "./admin/footer.inc.php";
}

function del_entry($entry_id,$tbl="gb") {
global $GB_UPLOAD;
switch ($tbl) {
case "gb" :
$this->db->query("select p_filename from ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=2)");
$result = $this->db->fetch_array($this->db->result);
if ($result["p_filename"]) {
if (file_exists("./$GB_UPLOAD/$result[p_filename]")) {
unlink ("./$GB_UPLOAD/$result[p_filename]");
}
if (file_exists("./$GB_UPLOAD/t_$result[p_filename]")) {
unlink ("./$GB_UPLOAD/t_$result[p_filename]");
}
}
$this->db->query("DELETE FROM ".$this->table['data']." WHERE (id = '$entry_id')");
$this->db->query("DELETE FROM ".$this->table['com']." WHERE (id = '$entry_id')");
$this->db->query("DELETE FROM ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=2)");
break;

case "priv" :
$this->db->query("select p_filename from ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=1)");
$result = $this->db->fetch_array($this->db->result);
if ($result["p_filename"]) {
if (file_exists("./$GB_UPLOAD/$result[p_filename]")) {
unlink ("./$GB_UPLOAD/$result[p_filename]");
}
if (file_exists("./$GB_UPLOAD/t_$result[p_filename]")) {
unlink ("./$GB_UPLOAD/t_$result[p_filename]");
}
}
$this->db->query("DELETE FROM ".$this->table['priv']." WHERE (id = '$entry_id')");
$this->db->query("DELETE FROM ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=1)");
break;

case "com" :
$this->db->query("DELETE FROM ".$this->table['com']." WHERE (com_id = '$entry_id')");
break;
}
}

function update_record($entry_id,$tbl="gb") {
global $HTTP_POST_VARS;
$gb_tbl = ($tbl=="priv") ? $this->table['priv'] : $this->table['data'];
if (!get_magic_quotes_gpc() ) {
while (list($var, $value)=each($HTTP_POST_VARS)) {
$HTTP_POST_VARS[$var]=addslashes($value);
}
}
reset($HTTP_POST_VARS);
while (list($var, $value)=each($HTTP_POST_VARS)) {
$HTTP_POST_VARS[$var]=trim($value);
}
if (!eregi(".+@[-a-z0-9_]+", $HTTP_POST_VARS['email'])) {
$HTTP_POST_VARS['email'] = '';
}
if (!eregi("^http://[-a-z0-9_]+", $HTTP_POST_VARS['url'])) {
$HTTP_POST_VARS['url'] = '';
}
$sqlquery= "UPDATE $gb_tbl set name='$HTTP_POST_VARS[name]', email='$HTTP_POST_VARS[email]', gender='$HTTP_POST_VARS[gender]', url='$HTTP_POST_VARS[url]', location='$HTTP_POST_VARS[location]', ";
$sqlquery.="host='$HTTP_POST_VARS[host]', browser='$HTTP_POST_VARS[browser]', comment='$HTTP_POST_VARS[comment]', icq='$HTTP_POST_VARS[icq]', aim='$HTTP_POST_VARS[aim]' WHERE (id = '$entry_id')";
$this->db->query($sqlquery);
}

function show_form($entry_id,$tbl="gb") {
global $record;
$gb_tbl = ($tbl=="priv") ? $this->table['priv'] : $this->table['data'];
$this->db->query("select * from $gb_tbl where (id = '$entry_id')");
$row = $this->db->fetch_array($this->db->result);
for(reset($row); $key=key($row); next($row)) {
$row[$key] = htmlspecialchars($row[$key]);
}
$this->NoCacheHeader();
include_once "./admin/panel_edit.php";
include_once "./admin/footer.inc.php";
}

function edit_template($tpl_name,$tpl_save) {
global $HTTP_POST_VARS, $GB_TPL;
$this->NoCacheHeader();
$filename = "./templates/$tpl_name";
if (file_exists("$filename") && $tpl_name != '') {
if ($tpl_save == "update") {
if (get_magic_quotes_gpc()) {
$HTTP_POST_VARS['gb_template'] = stripslashes($HTTP_POST_VARS['gb_template']);
}
$fd = fopen ($filename, "w");
fwrite($fd,$HTTP_POST_VARS['gb_template']);
$gb_template = $HTTP_POST_VARS['gb_template'];
} else {
$fd = fopen ($filename, "r");
$gb_template = fread ($fd, filesize ($filename));
}
fclose ($fd);
} else {
$gb_template ='';
}
include_once "./admin/panel_template.php";
include_once "./admin/footer.inc.php";
}

function show_settings($cat) {
$this->db->query("select * from ".$this->table['words']);
while ($this->db->fetch_array($this->db->result)) {
$badwords[] = $this->db->record["word"];
}
$this->db->free_result($this->db->result);
$this->db->query("select * from ".$this->table['ban']);
while ($this->db->fetch_array($this->db->result)) {
$banned_ips[] = $this->db->record["ban_ip"];
}
$this->db->free_result($this->db->result);
$this->db->query("select * from ".$this->table['auth']." where ID=$this->uid");
$row = $this->db->fetch_array($this->db->result);
$this->NoCacheHeader();
if ($cat == "general") {
include_once "./admin/panel_main.php";
} elseif ($cat == "style") {
include_once "./admin/panel_style.php";
} elseif ($cat == "pwd") {
include_once "./admin/panel_pwd.php";
}
include_once "./admin/footer.inc.php";
}

}

?>
ET
Graduate

Joined: 21/02/2003 22:17:48
Messages: 179
Offline

I'm not Amber - I just directed you to the post by Amber - the answer is there.

I don't see anything right off hand in your script - maybe someone else will? What, if anything, did you edit in that file?

Did you edit the lang/spanish.php?

Make certain to not have any empty/blank lines after the ?> at the end of the scripts. I believe that is what Amber is explaining.

---------------
Anonymous



Sorry ET...I realised that when I sent the reply...ops..

Anyway....Yes, I edited my lang/Spanish.php

Here is the script...Can anyone see anything wrong?

<?php
# General

$LANG["metatag"] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";

$LANG["BookMess1"] = "C&oacute;digo HTML deshabilitado";
$LANG["BookMess2"] = "C&oacute;digo HTML habilitado";
$LANG["BookMess3"] = "Firmar el Libro de Visitas - Sign Our Guestbook";
$LANG["BookMess4"] = "Volver el Libro de Visitas - Return to our Guestbook";
$LANG["BookMess5"] = "Administraci&oacute;n";
$LANG["BookMess6"] = "Gracias por venir a nuestro sitio. Aqu&iacute; puedes dejarnos tu mensaje. - Thanks for visiting our Guestbook. Please leave us a message";
$LANG["BookMess7"] = "Comentarios - Comments";
$LANG["BookMess8"] = "Volver al formulario de env&iacute;o";
$LANG["BookMess9"] = "Escribir un comentario para esta entrada del libro de visitas.";
$LANG["BookMess10"] = "<u>Gracias por firmar el libro de visitas.</u><br><br>&iexcl;Tu mensaje ha sido a&ntilde;adido con &eacute;xito! Dentro de 2 segundos deber&iacute;as haber regresado autom&aacute;ticamente al libro de visitas.";

$LANG["EmailAdminSubject"] = "Nueva entrada en el libro de visitas";
$LANG["EmailGuestSubject"] = "Gracias por firmar en el libro de visitas - Thank you for signing our Guestbook";

$LANG["AltIP"] = "IP registrada";
$LANG["AltICQ"] = "Enviar Mensaje ICQ";
$LANG["AltEmail"] = "Enviar E-mail";
$LANG["AltUrl"] = "Ver P&aacute;gina Web";
$LANG["AltAim"] = "Instant Messenger";
$LANG["AltCom"] = "Escribir un comentario - Write a comment";

# Form
$LANG["FormMess1"] = "Rellena los siguientes campos para firmar en el libro de visitas. Despu&eacute;s de enviar tu mensaje, regresar&aacute;s autom&aacute;ticamente al libro de visitas. Los espacios marcados con (*) representan campos obligatorios.";
$LANG["FormMess2"] = "Smilies Activados";
$LANG["FormMess3"] = "AGCode Activado";
$LANG["FormMess4"] = "Mostrar leyenda";
$LANG["FormMess5"] = "A continuaci&oacute;n se muestra tu mensaje.";
$LANG["FormMess6"] = "AGCode Desactivado";
$LANG["FormMess7"] = "Smilies Desactivados";
$LANG["FormName"] = "Nombre - Name";
$LANG["FormEmail"] = "E-mail";
$LANG["FormLoc"] = "Localizaci&oacute;n - Location";
$LANG["FormPic"] = "Fotograf&iacute;a - Photo";
$LANG["FormUrl"] = "P&aacute;gina web";
$LANG["FormGender"] = "Sexo";
$LANG["FormMale"] = "Hombre";
$LANG["FormFemale"] = "Mujer";
$LANG["FormMessage"] = "Tu mensaje - Your Message";
$LANG["FormSelect"] = "Libro de Visitas - Guestbook";
$LANG["FormUser"] = "Nombre de usuario";
$LANG["FormPass"] = "Contrase&ntilde;a";
$LANG["FormReset"] = "Borrar todos los campos";
$LANG["FormSubmit"] = "Enviar - Submit";
$LANG["FormPreview"] = "Vista previa";
$LANG["FormBack"] = "Volver atr&aacute;s";
$LANG["FormEnter"] = "Libro de Visitas - Centro de Administraci&oacute;n<br>&iexcl;Antes de seguir tienes que introducir un nombre de usuario y contrase&ntilde;a v&aacute;lidos!";
$LANG["FormButton"] = "Ir";
$LANG["FormPriv"] = "Mensaje privado";

# Navigation Bar
$LANG["NavTotal"] = "Registros en total:";
$LANG["NavRecords"] = "Registros mostrados por p&aacute;gina:";
$LANG["NavPrev"] = "P&aacute;gina anterior - Previous Page";
$LANG["NavNext"] = "P&aacute;gina siguiente - Next Page";

# Post Errors
$LANG["ErrorPost1"] = "Has olvidado rellenar el campo Nombre. Por favor corr&iacute;gelo y vuelve a enviar el mensaje.";
$LANG["ErrorPost2"] = "Has olvidado rellenar el campo Mensaje. Por favor corr&iacute;gelo y vuelve a enviarlo.";
$LANG["ErrorPost3"] = "Tu mensaje es o demasiado corto o demasiado largo. Por favor corr&iacute;gelo y vuelve a enviarlo.";
$LANG["ErrorPost4"] = "Al parecer uno de los campos de entrada no tiene un valor v&aacute;lido.";
$LANG["ErrorPost5"] = "Libro de Visitas - Error";
$LANG["ErrorPost6"] = "El fichero de imagen es demasiado grande";
$LANG["ErrorPost7"] = "Tipo incorrecto de fichero de imagen";
$LANG["ErrorPost8"] = "Lo siento, tenemos activado el control anti-desbordamiento. Por favor int&eacute;ntalo de nuevo dentro de un rato.";
$LANG["ErrorPost9"] = "&iexcl;Tu direcci&oacute;n IP est&aacute; bloqueada!";
$LANG["ErrorPost10"] = "Tu mensaje contiene algunas palabras no v&aacute;lidas. Por favor corr&iacute;gelo y vuelve a enviarlo.";
$LANG["ErrorPost11"] = "Has olvidado rellenar el campo Comentario. Por favor corr&iacute;gelo y vuelve a enviar el mensaje.";

$LANG["PassMess1"] = "Por favor introduce un nombre de usuario y contrase&ntilde;a v&aacute;lidos:";
$LANG["PassMess2"] = "Nombre de usuario o contrase&ntilde;a incorrectos. Por favor int&eacute;ntalo de nuevo.";
$LANG["PassMess3"] = "Lo siento, la contrase&ntilde;a que has introducido no es correcta.";

# Days
$weekday[0] = "Domingo";
$weekday[1] = "Lunes";
$weekday[2] = "Martes";
$weekday[3] = "Mi&eacute;rcoles";
$weekday[4] = "Jueves";
$weekday[5] = "Viernes";
$weekday[6] = "S&aacute;bado";

# Months
$months[0] = "Enero";
$months[1] = "Febrero";
$months[2] = "Marzo";
$months[3] = "Abril";
$months[4] = "Mayo";
$months[5] = "Junio";
$months[6] = "Julio";
$months[7] = "Agosto";
$months[8] = "Septiembre";
$months[9] = "Octubre";
$months[10] = "Noviembre";
$months[11] = "Diciembre";

?>
ET
Graduate

Joined: 21/02/2003 22:17:48
Messages: 179
Offline

Okay - so you have checked to make certain that there are not extra lines before <?php and none after ?> - right?

What lines did you edit so that I know where to look for errors - I'm not going to waste my time looking thru each and every line for potential errors if you did not edit all the lines....

---------------
Anonymous



Hi ET, I have singled out the lined I have edited, they are: (I pretty much, just added some english text with in the ""....Thanx


$LANG["BookMess3"] = "Firmar el Libro de Visitas - Sign Our Guestbook";

$LANG["BookMess4"] = "Volver el Libro de Visitas - Return to our Guestbook";
puedes dejarnos tu mensaje. - Thanks for visiting our Guestbook. Please leave us a message";

$LANG["BookMess7"] = "Comentarios - Comments";

$LANG["BookMess8"] = "Volver al formulario de env&iacute;o";

$LANG["EmailGuestSubject"] = "Gracias por firmar en el libro de visitas - Thank you for signing our Guestbook";

$LANG["AltCom"] = "Escribir un comentario - Write a comment";

$LANG["FormName"] = "Nombre - Name";

$LANG["FormEmail"] = "E-mail";

$LANG["FormLoc"] = "Localizaci&oacute;n - Location";

$LANG["FormPic"] = "Fotograf&iacute;a - Photo";

$LANG["FormUrl"] = "P&aacute;gina web";

$LANG["FormMessage"] = "Tu mensaje - Your Message";

$LANG["FormSelect"] = "Libro de Visitas - Guestbook";

$LANG["FormSubmit"] = "Enviar - Submit";

$LANG["NavPrev"] = "P&aacute;gina anterior - Previous Page";

$LANG["NavNext"] = "P&aacute;gina siguiente - Next Page";
Auron
Expert
[Avatar]

Joined: 23/06/2003 22:02:17
Messages: 1053
Offline

In that 'really' big post, at the end there is this...



Try changing it to...



Also, in the lang file...



Try changing to...


Visit my site @ www.ragnaru.com
Adv. Poll Install Guide NOW BACK ONLINE! (And also rather out of date I would of thought)
[Email] [WWW]
ET
Graduate

Joined: 21/02/2003 22:17:48
Messages: 179
Offline

Thanks for pointing those out - I don't see any errors in the modifications.

What I would recommend that you do is to download the original AG script again - save it into a different folder on your harddrive so that you have the original version onhand that you don't modify. Then upload that original spanish.php version back into the lang folder on your website to see if the error continues.

Essentially, we are just in problem solving mode at this point since you are certain that there are no spaces in the files before <?php and after ?> .... Sorry that it's not an immediate solution - I know how frustrating it can be.

---------------
Anonymous



Thanks Guys...(ET & Auron)

I did mods as per Auron and although it didn't completely fix the problem (errors still there) at least comment can be posted..(Thanx Auron)

Have a try adding a comment on an existing message...

http://rinconwebdesign.com/guestbook/index.php

See what I mean?...

Anyone has any other suggestions..? apart from "starting from scatch?"...

Thanx
ET
Graduate

Joined: 21/02/2003 22:17:48
Messages: 179
Offline

I tried to add a comment and still got the error....
Warning: Cannot modify header information - headers already sent by (output started at /home/rincon/public_html/guestbook/lang/spanish.php:107) in /home/rincon/public_html/guestbook/lib/comment.class.php on line 175

Did you try reinstalling the original version of spanish.php file without your edits to see it it would work?

---------------
Anonymous



Thanks ET...I can see your comment in my GB...

No I haven't tried reinstalling the original version of spanish.php file without my edits yet...might give that a go a bit later...Il just try to brainstorm a bit more before I do that...

Any other suggestions?
ET
Graduate

Joined: 21/02/2003 22:17:48
Messages: 179
Offline

No other suggestions based on what we have - given that the error I got still leads back to the spanish.php file - It is my assumption that the problem is there. I do have a question though....

What type of editor do you use when editing the spanish.php file?

---------------
Anonymous



Thanx ET..you have been a great help and given me a few ideas..

I edit the files via my hosting company Control Panel
ET
Graduate

Joined: 21/02/2003 22:17:48
Messages: 179
Offline

Editor in the Control Panel - That might be what is causing the problem.

Have you normally used the control panel editor to modify your php scripts/pages without any problems?

---------------
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum