Chi Kien Uong
Geranienstraße 30
71034 Böblingen
Deutschland / Germany
|
If you are not registered or logged in, you may still use these forums but with limited features.
Show recent topics
|
|
|
Author |
Message |
|
Solution to parse error in advanced guestbook?
Dont want to seem like im bumping this post, but since it is a new development on a field I havent seen any answers I figure that others may appreciate it for orderly purposes.
I reinstalled the guestbook as noted above, but during my customization, I figured I could perhaps upload one and one php file from my backed up faulty directory, and thus find the faulty file.
I backed up my new working guestbook and set to work. After uploading the file entry.php in the templates directory, I again received the parse error as noted above. When I reinstalled the backed up working entry.php file the parse error was gone. Hence it was also true as I noted in my first post that the error was unrelated to line 14 (or any other line?) in the gb.class.php file.
The entry.php file I had customized, and so it fit that it was I that created the error in the first place. Thus, when other users need to search where they were wrong, I suggest taking a backup copy of your existing entry.php file in the templates directory (or simply rename it entryold.php), and replace it with the original text that I include below.
Paste the content below into a blank notepad document and save as entry.php in your templates directory. You should not need to delete your guestbook as I did.
Please come back to this post and note if it works for you too.
entry.php: start your marker from <tr bgcolor....
<tr bgcolor="$bgcolor">
<td width="32%" valign="top">
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="font2" valign="top" width="8%"><b>$id)</b></td>
<td width="92%"> <img src="img/ip.gif" width="14" height="14" alt="$LANG[AltIP]"> <img src="img/browser.gif" width="16" height="16" alt="$row[browser]">
$URL
$ICQ
$AIM
</td>
</tr>
<tr>
<td colspan="2" class="font1"><b>$row[name]</b> $GENDER</td>
</tr>
<tr>
<td colspan="2" class="font1">$row[email]</td>
</tr>
<tr>
<td colspan="2" class="font2">$LANG[FormLoc]:<br>$row[location]</td>
</tr>
</table>
</td>
<td width="68%" class="font1" valign="top">
<div align="left" class="font3"><img src="img/post.gif" width="9" height="9">$DATE $HOST
<a href="comment.php?gb_id=$row[id]"><img src="img/edit.gif" width="18" height="13" border="0" alt="$LANG[AltCom]"></a>
$EMAIL
</div>
<hr size="1"><div align="left">
$MESSAGE
</div>
$COMMENT
</td>
</tr>
end your marking at ...tr> and copy into notepad.
Save as entry.php in the Templates directory of your guestbook. Check your guestbook to see if it works. The change should apply immediately.
ibs
|
|
|
This is a description of how to reinstall database of your guestbook from scratch. If you have the parse error, see the below post rather than this.
Hi,
Didnt find any answers to my question, so in lack of php knowledge I fixed the problem manually.
That is, I first saved the data entries (86) that I had manually inserted by selecting data and export and export as mysql - saved onto my harddisk.
Then I deleted the whole guestbook with all entries from my webserver. Then I reinstalled the guestbook, entered the phpmyadmin provided by my host, deleted the data table and imported (select query window then import) the mysql file that I had saved previously.
It now has all the entries. Now I need to re customize the page to fit the layout of my site in general. A couple of hours work, true, but hopefully the guestbook will be up and running again like before my vicious parse error.
Hope this is a little help to others finding the same problem.
see if it worked at: http://ibsite.com/guestbook/index.php
ibs
|
|
|
My gb.class.php document reads:
CODE DELETED.
SEE ISSUE WITH entry.php FILE BELOW.
|
|
|
Hi, Im getting the error message
on my page
http://www.ibsite.com/guestbook/index.php
whenever I try to access the view page of my advanced guestbook. It just appeared. One day it worked, the next day it didnt. (Perhpas related to slow refreshreate of IE). I have tried installing a new guestbook, replacing the working gb.class.php entry from the new book, but to no avail. That leads me to suspect the problem lies elsewhere in the guestbook, but I have no idea where.
I have manually entered about 80 visits from my old guestbook, and wouldnt like to have to customize a new guestbook all over again.
Ive found a couple of entries in this forum on the problem
http://proxy2.de/forum/viewtopic.php?t=2128
http://proxy2.de/forum/viewtopic.php?t=2085
http://proxy2.de/forum/viewtopic.php?t=2059
http://proxy2.de/forum/viewtopic.php?t=1836
http://proxy2.de/forum/viewtopic.php?t=1560
http://proxy2.de/forum/viewtopic.php?t=747
but none with adequate answers.
I got timeout when I tried to include the code, so ill try to do that in the next post.
Upon searching php forums, Ive found that actual errors to often are a couple of lines under or above the referred line, but as my knowledge of php is limited to searching in forums, they dont tell me much when I dont find an entry with exactly the same problem as I have.
Hope someone here can help me.
Ibs
|
|
|
Hi, Im getting the error message
on my page
http://www.ibsite.com/guestbook/index.php
whenever I try to access the view page of my advanced guestbook. It just appeared. One day it worked, the next day it didnt. (Perhpas related to slow refreshreate of IE). I have tried installing a new guestbook, replacing the working gb.class.php entry from the new book, but to no avail. That leads me to suspect the problem lies elsewhere in the guestbook, but I have no idea where.
I have manually entered about 80 visits from my old guestbook, and wouldnt like to have to customize a new guestbook all over again.
Ive found two entries in this forum on the problem
http://proxy2.de/forum/viewtopic.php?t=2128&highlight=expecting+tstring+tvariable+tnumstring
http://proxy2.de/forum/viewtopic.php?t=2085&highlight=expecting+tstring+tvariable+tnumstring
but none with adequate answers. My gb.class.php document reads:
with line 14 in bold
<?php
/**
* ----------------------------------------------
* Advanced Guestbook 2.2 (PHP/MySQL)
* Copyright (c)2001 Chi Kien Uong
* URL: http://www.proxy2.de
* ----------------------------------------------
*/
class guestbook {
var $total;
var $db;
var $template;
function guestbook($path='') {
$this->db = new guestbook_vars($path);
$this->db->getVars();
$this->total = 0;
$this->template =& $this->db->template;
}
function get_nav($entry=0) {
global $HTTP_SERVER_VARS;
$self = basename($HTTP_SERVER_VARS['PHP_SELF']);
$next_page = $entry+$this->db->VARS['entries_per_page'];
$prev_page = $entry-$this->db->VARS['entries_per_page'];
$navigation = '';
if ($prev_page >= 0) {
$navigation = " <img src=\"img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self?entry=$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
}
if ($next_page < $this->total) {
$navigation = $navigation." <a href=\"$self?entry=$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"img/next.gif\" width=\"16\" height=\"14\">\n";
}
return $navigation;
}
function show_entries($entry=0) {
$LANG =& $this->db->LANG;
$VARS =& $this->db->VARS;
$this->db->fetch_array($this->db->query("select count(*) total from ".$this->db->table['data']));
$this->total = $this->db->record["total"];
$TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
$TPL['GB_TOTAL'] = $this->total;
$TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
$TPL['GB_TIME'] = $this->db->DateFormat(time());
$TPL['GB_NAVIGATION'] = $this->get_nav($entry);
$TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
return $guestbook_html;
}
function generate_JumpMenu() {
$menu_array[] = "<select name=\"entry\" class=\"select\">";
$menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
if ($this->db->VARS["entries_per_page"] < $this->total) {
$remain = $this->total % $this->db->VARS["entries_per_page"];
$i = $this->total-$remain;
while ($i > 0) {
$num_max = $i;
$num_min = $num_max-$this->db->VARS["entries_per_page"];
$num_min++;
$menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
$i = $num_min-1;
$remain += $this->db->VARS["entries_per_page"];
}
}
$menu_array[] = "</select>";
$menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
return $menu_array;
}
function get_entries($entry,$last_entry) {
$LANG =& $this->db->LANG;
$id = $this->total-$entry;
$HOST = '';
$COMMENT = '';
$GB_ENTRIES = '';
$i=0;
$template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
$template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
$template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
$template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
$template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
$template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
$result = $this->db->query("select * from ".$this->db->table['data']." order by id desc limit $entry, $last_entry");
while ($row = $this->db->fetch_array($result)) {
$DATE = $this->db->DateFormat($row['date']);
$MESSAGE = nl2br($row['comment']);
if ($this->db->VARS["smilies"] == 1) {
$MESSAGE = $this->db->emotion($MESSAGE);
}
if (!$row['location']) {
$row['location'] = "-";
}
$bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
$i++;
if ($row['url']) {
eval("\$URL = \"".$template['url']."\";");
} else {
$URL = '';
}
if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
eval("\$ICQ = \"".$template['icq']."\";");
} else {
$ICQ = '';
}
if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
eval("\$AIM = \"".$template['aim']."\";");
} else {
$AIM = '';
}
if ($row['email']) {
eval("\$EMAIL = \"".$template['email']."\";");
} else {
$EMAIL = '';
}
if ($this->db->VARS["allow_gender"]==1) {
$GENDER = ($row['gender']=="f") ? " <img src=\"img/female.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/male.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["show_ip"] == 1) {
$hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
$HOST = "$hostname: $row[host]\n";
}
$this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
while ($com = $this->db->fetch_array($this->db->result)) {
$com['comments'] = nl2br($com['comments']);
eval("\$COMMENT .= \"".$template['com']."\";");
}
eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
$COMMENT = "";
$id--;
}
$TPL['GB_ENTRIES'] = $GB_ENTRIES;
return $TPL;
}
}
?>
Upon searching php forums, Ive found that actual errors to often are a couple of lines under or above the referred line, but as my knowledge of php is limited to searching in forums, they dont tell me much when I dont find an entry with exactly the same problem as I have.
Hope someone here can help me.
Ibs
|
|
|
Hi, Im getting the error message
on my page
http://www.ibsite.com/guestbook/index.php
whenever I try to access the view page of my advanced guestbook. It just appeared. One day it worked, the next day it didnt. (Perhpas related to slow refreshreate of IE). I have tried installing a new guestbook, replacing the working gb.class.php entry from the new book, but to no avail. That leads me to suspect the problem lies elsewhere in the guestbook, but I have no idea where.
I have manually entered about 80 visits from my old guestbook, and wouldnt like to have to customize a new guestbook all over again.
Ive found two entries in this forum on the problem
http://proxy2.de/forum/viewtopic.php?t=2128&highlight=expecting+tstring+tvariable+tnumstring
http://proxy2.de/forum/viewtopic.php?t=2085&highlight=expecting+tstring+tvariable+tnumstring
but none with adequate answers. My gb.class.php document reads:
with line 14 in bold
<?php
/**
* ----------------------------------------------
* Advanced Guestbook 2.2 (PHP/MySQL)
* Copyright (c)2001 Chi Kien Uong
* URL: http://www.proxy2.de
* ----------------------------------------------
*/
class guestbook {
var $total;
var $db;
var $template;
function guestbook($path='') {
$this->db = new guestbook_vars($path);
$this->db->getVars();
$this->total = 0;
$this->template =& $this->db->template;
}
function get_nav($entry=0) {
global $HTTP_SERVER_VARS;
$self = basename($HTTP_SERVER_VARS['PHP_SELF']);
$next_page = $entry+$this->db->VARS['entries_per_page'];
$prev_page = $entry-$this->db->VARS['entries_per_page'];
$navigation = '';
if ($prev_page >= 0) {
$navigation = " <img src=\"img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self?entry=$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
}
if ($next_page < $this->total) {
$navigation = $navigation." <a href=\"$self?entry=$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"img/next.gif\" width=\"16\" height=\"14\">\n";
}
return $navigation;
}
function show_entries($entry=0) {
$LANG =& $this->db->LANG;
$VARS =& $this->db->VARS;
$this->db->fetch_array($this->db->query("select count(*) total from ".$this->db->table['data']));
$this->total = $this->db->record["total"];
$TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
$TPL['GB_TOTAL'] = $this->total;
$TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
$TPL['GB_TIME'] = $this->db->DateFormat(time());
$TPL['GB_NAVIGATION'] = $this->get_nav($entry);
$TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
return $guestbook_html;
}
function generate_JumpMenu() {
$menu_array[] = "<select name=\"entry\" class=\"select\">";
$menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
if ($this->db->VARS["entries_per_page"] < $this->total) {
$remain = $this->total % $this->db->VARS["entries_per_page"];
$i = $this->total-$remain;
while ($i > 0) {
$num_max = $i;
$num_min = $num_max-$this->db->VARS["entries_per_page"];
$num_min++;
$menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
$i = $num_min-1;
$remain += $this->db->VARS["entries_per_page"];
}
}
$menu_array[] = "</select>";
$menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
return $menu_array;
}
function get_entries($entry,$last_entry) {
$LANG =& $this->db->LANG;
$id = $this->total-$entry;
$HOST = '';
$COMMENT = '';
$GB_ENTRIES = '';
$i=0;
$template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
$template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
$template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
$template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
$template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
$template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
$result = $this->db->query("select * from ".$this->db->table['data']." order by id desc limit $entry, $last_entry");
while ($row = $this->db->fetch_array($result)) {
$DATE = $this->db->DateFormat($row['date']);
$MESSAGE = nl2br($row['comment']);
if ($this->db->VARS["smilies"] == 1) {
$MESSAGE = $this->db->emotion($MESSAGE);
}
if (!$row['location']) {
$row['location'] = "-";
}
$bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
$i++;
if ($row['url']) {
eval("\$URL = \"".$template['url']."\";");
} else {
$URL = '';
}
if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
eval("\$ICQ = \"".$template['icq']."\";");
} else {
$ICQ = '';
}
if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
eval("\$AIM = \"".$template['aim']."\";");
} else {
$AIM = '';
}
if ($row['email']) {
eval("\$EMAIL = \"".$template['email']."\";");
} else {
$EMAIL = '';
}
if ($this->db->VARS["allow_gender"]==1) {
$GENDER = ($row['gender']=="f") ? " <img src=\"img/female.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/male.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["show_ip"] == 1) {
$hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
$HOST = "$hostname: $row[host]\n";
}
$this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
while ($com = $this->db->fetch_array($this->db->result)) {
$com['comments'] = nl2br($com['comments']);
eval("\$COMMENT .= \"".$template['com']."\";");
}
eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
$COMMENT = "";
$id--;
}
$TPL['GB_ENTRIES'] = $GB_ENTRIES;
return $TPL;
}
}
?>
Upon searching php forums, Ive found that actual errors to often are a couple of lines under or above the referred line, but as my knowledge of php is limited to searching in forums, they dont tell me much when I dont find an entry with exactly the same problem as I have.
Hope someone here can help me.
Ibs
|
|
|
Hi, Im getting the error message
on my page
http://www.ibsite.com/guestbook/index.php
whenever I try to access the view page of my advanced guestbook. It just appeared. One day it worked, the next day it didnt. (Perhpas related to slow refreshreate of IE). I have tried installing a new guestbook, replacing the working gb.class.php entry from the new book, but to no avail. That leads me to suspect the problem lies elsewhere in the guestbook, but I have no idea where.
I have manually entered about 80 visits from my old guestbook, and wouldnt like to have to customize a new guestbook all over again.
Ive found two entries in this forum on the problem
http://proxy2.de/forum/viewtopic.php?t=2128&highlight=expecting+tstring+tvariable+tnumstring
http://proxy2.de/forum/viewtopic.php?t=2085&highlight=expecting+tstring+tvariable+tnumstring
but none with adequate answers. My gb.class.php document reads:
with line 14 in bold
<?php
/**
* ----------------------------------------------
* Advanced Guestbook 2.2 (PHP/MySQL)
* Copyright (c)2001 Chi Kien Uong
* URL: http://www.proxy2.de
* ----------------------------------------------
*/
class guestbook {
var $total;
var $db;
var $template;
function guestbook($path='') {
$this->db = new guestbook_vars($path);
$this->db->getVars();
$this->total = 0;
$this->template =& $this->db->template;
}
function get_nav($entry=0) {
global $HTTP_SERVER_VARS;
$self = basename($HTTP_SERVER_VARS['PHP_SELF']);
$next_page = $entry+$this->db->VARS['entries_per_page'];
$prev_page = $entry-$this->db->VARS['entries_per_page'];
$navigation = '';
if ($prev_page >= 0) {
$navigation = " <img src=\"img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self?entry=$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
}
if ($next_page < $this->total) {
$navigation = $navigation." <a href=\"$self?entry=$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"img/next.gif\" width=\"16\" height=\"14\">\n";
}
return $navigation;
}
function show_entries($entry=0) {
$LANG =& $this->db->LANG;
$VARS =& $this->db->VARS;
$this->db->fetch_array($this->db->query("select count(*) total from ".$this->db->table['data']));
$this->total = $this->db->record["total"];
$TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
$TPL['GB_TOTAL'] = $this->total;
$TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
$TPL['GB_TIME'] = $this->db->DateFormat(time());
$TPL['GB_NAVIGATION'] = $this->get_nav($entry);
$TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
return $guestbook_html;
}
function generate_JumpMenu() {
$menu_array[] = "<select name=\"entry\" class=\"select\">";
$menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
if ($this->db->VARS["entries_per_page"] < $this->total) {
$remain = $this->total % $this->db->VARS["entries_per_page"];
$i = $this->total-$remain;
while ($i > 0) {
$num_max = $i;
$num_min = $num_max-$this->db->VARS["entries_per_page"];
$num_min++;
$menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
$i = $num_min-1;
$remain += $this->db->VARS["entries_per_page"];
}
}
$menu_array[] = "</select>";
$menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
return $menu_array;
}
function get_entries($entry,$last_entry) {
$LANG =& $this->db->LANG;
$id = $this->total-$entry;
$HOST = '';
$COMMENT = '';
$GB_ENTRIES = '';
$i=0;
$template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
$template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
$template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
$template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
$template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
$template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
$result = $this->db->query("select * from ".$this->db->table['data']." order by id desc limit $entry, $last_entry");
while ($row = $this->db->fetch_array($result)) {
$DATE = $this->db->DateFormat($row['date']);
$MESSAGE = nl2br($row['comment']);
if ($this->db->VARS["smilies"] == 1) {
$MESSAGE = $this->db->emotion($MESSAGE);
}
if (!$row['location']) {
$row['location'] = "-";
}
$bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
$i++;
if ($row['url']) {
eval("\$URL = \"".$template['url']."\";");
} else {
$URL = '';
}
if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
eval("\$ICQ = \"".$template['icq']."\";");
} else {
$ICQ = '';
}
if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
eval("\$AIM = \"".$template['aim']."\";");
} else {
$AIM = '';
}
if ($row['email']) {
eval("\$EMAIL = \"".$template['email']."\";");
} else {
$EMAIL = '';
}
if ($this->db->VARS["allow_gender"]==1) {
$GENDER = ($row['gender']=="f") ? " <img src=\"img/female.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/male.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["show_ip"] == 1) {
$hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
$HOST = "$hostname: $row[host]\n";
}
$this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
while ($com = $this->db->fetch_array($this->db->result)) {
$com['comments'] = nl2br($com['comments']);
eval("\$COMMENT .= \"".$template['com']."\";");
}
eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
$COMMENT = "";
$id--;
}
$TPL['GB_ENTRIES'] = $GB_ENTRIES;
return $TPL;
}
}
?>
Upon searching php forums, Ive found that actual errors to often are a couple of lines under or above the referred line, but as my knowledge of php is limited to searching in forums, they dont tell me much when I dont find an entry with exactly the same problem as I have.
Hope someone here can help me.
Ibs
|
|
|
Hi, Im getting the error message
on my page
http://www.ibsite.com/guestbook/index.php
whenever I try to access the view page of my advanced guestbook. It just appeared. One day it worked, the next day it didnt. (Perhpas related to slow refreshreate of IE). I have tried installing a new guestbook, replacing the working gb.class.php entry from the new book, but to no avail. That leads me to suspect the problem lies elsewhere in the guestbook, but I have no idea where.
I have manually entered about 80 visits from my old guestbook, and wouldnt like to have to customize a new guestbook all over again.
Ive found two entries in this forum on the problem
http://proxy2.de/forum/viewtopic.php?t=2128&highlight=expecting+tstring+tvariable+tnumstring
http://proxy2.de/forum/viewtopic.php?t=2085&highlight=expecting+tstring+tvariable+tnumstring
but none with adequate answers. My gb.class.php document reads:
with line 14 in bold
<?php
/**
* ----------------------------------------------
* Advanced Guestbook 2.2 (PHP/MySQL)
* Copyright (c)2001 Chi Kien Uong
* URL: http://www.proxy2.de
* ----------------------------------------------
*/
class guestbook {
var $total;
var $db;
var $template;
function guestbook($path='') {
$this->db = new guestbook_vars($path);
$this->db->getVars();
$this->total = 0;
$this->template =& $this->db->template;
}
function get_nav($entry=0) {
global $HTTP_SERVER_VARS;
$self = basename($HTTP_SERVER_VARS['PHP_SELF']);
$next_page = $entry+$this->db->VARS['entries_per_page'];
$prev_page = $entry-$this->db->VARS['entries_per_page'];
$navigation = '';
if ($prev_page >= 0) {
$navigation = " <img src=\"img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self?entry=$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
}
if ($next_page < $this->total) {
$navigation = $navigation." <a href=\"$self?entry=$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"img/next.gif\" width=\"16\" height=\"14\">\n";
}
return $navigation;
}
function show_entries($entry=0) {
$LANG =& $this->db->LANG;
$VARS =& $this->db->VARS;
$this->db->fetch_array($this->db->query("select count(*) total from ".$this->db->table['data']));
$this->total = $this->db->record["total"];
$TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
$TPL['GB_TOTAL'] = $this->total;
$TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
$TPL['GB_TIME'] = $this->db->DateFormat(time());
$TPL['GB_NAVIGATION'] = $this->get_nav($entry);
$TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
return $guestbook_html;
}
function generate_JumpMenu() {
$menu_array[] = "<select name=\"entry\" class=\"select\">";
$menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
if ($this->db->VARS["entries_per_page"] < $this->total) {
$remain = $this->total % $this->db->VARS["entries_per_page"];
$i = $this->total-$remain;
while ($i > 0) {
$num_max = $i;
$num_min = $num_max-$this->db->VARS["entries_per_page"];
$num_min++;
$menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
$i = $num_min-1;
$remain += $this->db->VARS["entries_per_page"];
}
}
$menu_array[] = "</select>";
$menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
return $menu_array;
}
function get_entries($entry,$last_entry) {
$LANG =& $this->db->LANG;
$id = $this->total-$entry;
$HOST = '';
$COMMENT = '';
$GB_ENTRIES = '';
$i=0;
$template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
$template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
$template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
$template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
$template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
$template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
$result = $this->db->query("select * from ".$this->db->table['data']." order by id desc limit $entry, $last_entry");
while ($row = $this->db->fetch_array($result)) {
$DATE = $this->db->DateFormat($row['date']);
$MESSAGE = nl2br($row['comment']);
if ($this->db->VARS["smilies"] == 1) {
$MESSAGE = $this->db->emotion($MESSAGE);
}
if (!$row['location']) {
$row['location'] = "-";
}
$bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
$i++;
if ($row['url']) {
eval("\$URL = \"".$template['url']."\";");
} else {
$URL = '';
}
if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
eval("\$ICQ = \"".$template['icq']."\";");
} else {
$ICQ = '';
}
if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
eval("\$AIM = \"".$template['aim']."\";");
} else {
$AIM = '';
}
if ($row['email']) {
eval("\$EMAIL = \"".$template['email']."\";");
} else {
$EMAIL = '';
}
if ($this->db->VARS["allow_gender"]==1) {
$GENDER = ($row['gender']=="f") ? " <img src=\"img/female.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/male.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["show_ip"] == 1) {
$hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
$HOST = "$hostname: $row[host]\n";
}
$this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
while ($com = $this->db->fetch_array($this->db->result)) {
$com['comments'] = nl2br($com['comments']);
eval("\$COMMENT .= \"".$template['com']."\";");
}
eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
$COMMENT = "";
$id--;
}
$TPL['GB_ENTRIES'] = $GB_ENTRIES;
return $TPL;
}
}
?>
Upon searching php forums, Ive found that actual errors to often are a couple of lines under or above the referred line, but as my knowledge of php is limited to searching in forums, they dont tell me much when I dont find an entry with exactly the same problem as I have.
Hope someone here can help me.
Ibs
|
|
|
Hi, Im getting the error message
on my page
http://www.ibsite.com/guestbook/index.php
whenever I try to access the view page of my advanced guestbook. It just appeared. One day it worked, the next day it didnt. (Perhpas related to slow refreshreate of IE). I have tried installing a new guestbook, replacing the working gb.class.php entry from the new book, but to no avail. That leads me to suspect the problem lies elsewhere in the guestbook, but I have no idea where.
I have manually entered about 80 visits from my old guestbook, and wouldnt like to have to customize a new guestbook all over again.
Ive found two entries in this forum on the problem
http://proxy2.de/forum/viewtopic.php?t=2128&highlight=expecting+tstring+tvariable+tnumstring
http://proxy2.de/forum/viewtopic.php?t=2085&highlight=expecting+tstring+tvariable+tnumstring
but none with adequate answers. My gb.class.php document reads:
with line 14 in bold
<?php
/**
* ----------------------------------------------
* Advanced Guestbook 2.2 (PHP/MySQL)
* Copyright (c)2001 Chi Kien Uong
* URL: http://www.proxy2.de
* ----------------------------------------------
*/
class guestbook {
var $total;
var $db;
var $template;
function guestbook($path='') {
$this->db = new guestbook_vars($path);
$this->db->getVars();
$this->total = 0;
$this->template =& $this->db->template;
}
function get_nav($entry=0) {
global $HTTP_SERVER_VARS;
$self = basename($HTTP_SERVER_VARS['PHP_SELF']);
$next_page = $entry+$this->db->VARS['entries_per_page'];
$prev_page = $entry-$this->db->VARS['entries_per_page'];
$navigation = '';
if ($prev_page >= 0) {
$navigation = " <img src=\"img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self?entry=$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
}
if ($next_page < $this->total) {
$navigation = $navigation." <a href=\"$self?entry=$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"img/next.gif\" width=\"16\" height=\"14\">\n";
}
return $navigation;
}
function show_entries($entry=0) {
$LANG =& $this->db->LANG;
$VARS =& $this->db->VARS;
$this->db->fetch_array($this->db->query("select count(*) total from ".$this->db->table['data']));
$this->total = $this->db->record["total"];
$TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
$TPL['GB_TOTAL'] = $this->total;
$TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
$TPL['GB_TIME'] = $this->db->DateFormat(time());
$TPL['GB_NAVIGATION'] = $this->get_nav($entry);
$TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
return $guestbook_html;
}
function generate_JumpMenu() {
$menu_array[] = "<select name=\"entry\" class=\"select\">";
$menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
if ($this->db->VARS["entries_per_page"] < $this->total) {
$remain = $this->total % $this->db->VARS["entries_per_page"];
$i = $this->total-$remain;
while ($i > 0) {
$num_max = $i;
$num_min = $num_max-$this->db->VARS["entries_per_page"];
$num_min++;
$menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
$i = $num_min-1;
$remain += $this->db->VARS["entries_per_page"];
}
}
$menu_array[] = "</select>";
$menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
return $menu_array;
}
function get_entries($entry,$last_entry) {
$LANG =& $this->db->LANG;
$id = $this->total-$entry;
$HOST = '';
$COMMENT = '';
$GB_ENTRIES = '';
$i=0;
$template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
$template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
$template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
$template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
$template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
$template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
$result = $this->db->query("select * from ".$this->db->table['data']." order by id desc limit $entry, $last_entry");
while ($row = $this->db->fetch_array($result)) {
$DATE = $this->db->DateFormat($row['date']);
$MESSAGE = nl2br($row['comment']);
if ($this->db->VARS["smilies"] == 1) {
$MESSAGE = $this->db->emotion($MESSAGE);
}
if (!$row['location']) {
$row['location'] = "-";
}
$bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
$i++;
if ($row['url']) {
eval("\$URL = \"".$template['url']."\";");
} else {
$URL = '';
}
if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
eval("\$ICQ = \"".$template['icq']."\";");
} else {
$ICQ = '';
}
if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
eval("\$AIM = \"".$template['aim']."\";");
} else {
$AIM = '';
}
if ($row['email']) {
eval("\$EMAIL = \"".$template['email']."\";");
} else {
$EMAIL = '';
}
if ($this->db->VARS["allow_gender"]==1) {
$GENDER = ($row['gender']=="f") ? " <img src=\"img/female.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/male.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["show_ip"] == 1) {
$hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
$HOST = "$hostname: $row[host]\n";
}
$this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
while ($com = $this->db->fetch_array($this->db->result)) {
$com['comments'] = nl2br($com['comments']);
eval("\$COMMENT .= \"".$template['com']."\";");
}
eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
$COMMENT = "";
$id--;
}
$TPL['GB_ENTRIES'] = $GB_ENTRIES;
return $TPL;
}
}
?>
Upon searching php forums, Ive found that actual errors to often are a couple of lines under or above the referred line, but as my knowledge of php is limited to searching in forums, they dont tell me much when I dont find an entry with exactly the same problem as I have.
Hope someone here can help me.
Ibs
|
|
|
Hi, Im getting the error message
on my page
http://www.ibsite.com/guestbook/index.php
whenever I try to access the view page of my advanced guestbook. It just appeared. One day it worked, the next day it didnt. (Perhpas related to slow refreshreate of IE). I have tried installing a new guestbook, replacing the working gb.class.php entry from the new book, but to no avail. That leads me to suspect the problem lies elsewhere in the guestbook, but I have no idea where.
I have manually entered about 80 visits from my old guestbook, and wouldnt like to have to customize a new guestbook all over again.
Ive found two entries in this forum on the problem
http://proxy2.de/forum/viewtopic.php?t=2128&highlight=expecting+tstring+tvariable+tnumstring
http://proxy2.de/forum/viewtopic.php?t=2085&highlight=expecting+tstring+tvariable+tnumstring
but none with adequate answers. My gb.class.php document reads:
with line 14 in bold
<?php
/**
* ----------------------------------------------
* Advanced Guestbook 2.2 (PHP/MySQL)
* Copyright (c)2001 Chi Kien Uong
* URL: http://www.proxy2.de
* ----------------------------------------------
*/
class guestbook {
var $total;
var $db;
var $template;
function guestbook($path='') {
$this->db = new guestbook_vars($path);
$this->db->getVars();
$this->total = 0;
$this->template =& $this->db->template;
}
function get_nav($entry=0) {
global $HTTP_SERVER_VARS;
$self = basename($HTTP_SERVER_VARS['PHP_SELF']);
$next_page = $entry+$this->db->VARS['entries_per_page'];
$prev_page = $entry-$this->db->VARS['entries_per_page'];
$navigation = '';
if ($prev_page >= 0) {
$navigation = " <img src=\"img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self?entry=$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
}
if ($next_page < $this->total) {
$navigation = $navigation." <a href=\"$self?entry=$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"img/next.gif\" width=\"16\" height=\"14\">\n";
}
return $navigation;
}
function show_entries($entry=0) {
$LANG =& $this->db->LANG;
$VARS =& $this->db->VARS;
$this->db->fetch_array($this->db->query("select count(*) total from ".$this->db->table['data']));
$this->total = $this->db->record["total"];
$TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
$TPL['GB_TOTAL'] = $this->total;
$TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
$TPL['GB_TIME'] = $this->db->DateFormat(time());
$TPL['GB_NAVIGATION'] = $this->get_nav($entry);
$TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
return $guestbook_html;
}
function generate_JumpMenu() {
$menu_array[] = "<select name=\"entry\" class=\"select\">";
$menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
if ($this->db->VARS["entries_per_page"] < $this->total) {
$remain = $this->total % $this->db->VARS["entries_per_page"];
$i = $this->total-$remain;
while ($i > 0) {
$num_max = $i;
$num_min = $num_max-$this->db->VARS["entries_per_page"];
$num_min++;
$menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
$i = $num_min-1;
$remain += $this->db->VARS["entries_per_page"];
}
}
$menu_array[] = "</select>";
$menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
return $menu_array;
}
function get_entries($entry,$last_entry) {
$LANG =& $this->db->LANG;
$id = $this->total-$entry;
$HOST = '';
$COMMENT = '';
$GB_ENTRIES = '';
$i=0;
$template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
$template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
$template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
$template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
$template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
$template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
$result = $this->db->query("select * from ".$this->db->table['data']." order by id desc limit $entry, $last_entry");
while ($row = $this->db->fetch_array($result)) {
$DATE = $this->db->DateFormat($row['date']);
$MESSAGE = nl2br($row['comment']);
if ($this->db->VARS["smilies"] == 1) {
$MESSAGE = $this->db->emotion($MESSAGE);
}
if (!$row['location']) {
$row['location'] = "-";
}
$bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
$i++;
if ($row['url']) {
eval("\$URL = \"".$template['url']."\";");
} else {
$URL = '';
}
if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
eval("\$ICQ = \"".$template['icq']."\";");
} else {
$ICQ = '';
}
if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
eval("\$AIM = \"".$template['aim']."\";");
} else {
$AIM = '';
}
if ($row['email']) {
eval("\$EMAIL = \"".$template['email']."\";");
} else {
$EMAIL = '';
}
if ($this->db->VARS["allow_gender"]==1) {
$GENDER = ($row['gender']=="f") ? " <img src=\"img/female.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/male.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["show_ip"] == 1) {
$hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
$HOST = "$hostname: $row[host]\n";
}
$this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
while ($com = $this->db->fetch_array($this->db->result)) {
$com['comments'] = nl2br($com['comments']);
eval("\$COMMENT .= \"".$template['com']."\";");
}
eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
$COMMENT = "";
$id--;
}
$TPL['GB_ENTRIES'] = $GB_ENTRIES;
return $TPL;
}
}
?>
Upon searching php forums, Ive found that actual errors to often are a couple of lines under or above the referred line, but as my knowledge of php is limited to searching in forums, they dont tell me much when I dont find an entry with exactly the same problem as I have.
Hope someone here can help me.
Ibs
|
|
|
|
|
|
Based on the open source JForum
|