...

View Full Version : Problems with a simple guestbook



markowi3
01-14-2008, 03:18 PM
I am using a flat file guestbook that it seems many have asked about. It is just ardgb18 using an index.php, image.php and it writes to a file called ardgb18.dat. All seems to work fine, but when the guestbook is viewed, it seems each entry is about a hundred lines long with the text centered so it looks empty. Please take a look at kimskuttingkorner.com/guestbook and let me know if you can help.

Thank You

Leslie

mlse
01-14-2008, 03:25 PM
Hi Leslie,

What on Earth is "ardgb18" ??!!

Could you post some code please?

Thanks.

markowi3
01-14-2008, 03:32 PM
Here is a zipped file of all needed files (I left out the images)

thanks

leslie

mlse
01-14-2008, 03:43 PM
Hi Leslie, have you tried to fix the problem yourself? What solutions have you tried? Which specific bits of code are you struggling with?

Without wishing to sound accusatory, it would seem that you've just taken your whole guestbook, zipped it and dumped it in the forum for someone else to fix! (E.g., there's 600 lines of code in index.php ...)

shyam
01-14-2008, 03:55 PM
I am using a flat file guestbook that it seems many have asked about. It is just ardgb18 using an index.php, image.php and it writes to a file called ardgb18.dat. All seems to work fine, but when the guestbook is viewed, it seems each entry is about a hundred lines long with the text centered so it looks empty. Please take a look at kimskuttingkorner.com/guestbook and let me know if you can help.

http://kimskuttingkorner.com/guestbook/imgs/del.gif this image is 12px wide and 41472px in height....that is ur problem...there is nothing wrong with ur php code!!! the gif file is corrupted..just fix that

markowi3
01-14-2008, 03:57 PM
Yes, I have spent two days staring at this code. It just does not seem that it would be that complex. I have even looked online at other people using this same guestbook. Again, it seems like such a simple flat file piece of code. I first thought that it was the index.php that would set the size of the table row that was holding each entry. I am pretty new to this, so it seemed that it was in this section of code of the index.php file

for ($i=0; $i<$max_entry_per_page; $i++) {
$nomrec++;
$no++;
//$no--;
$recno = $nomrec-1;
if (isset($record[$recno])) {
$row = explode("|~|",$record[$recno]);
if ($w==0) {
$warna = $table_content_1a;
$warna2 = $table_content_1b;
$w=1;
} else {
$warna = $table_content_2a;
$warna2 = $table_content_2b;
$w=0;
}
echo "<tr>
<td bgcolor=\"$warna2\" align=\"center\" valign=\"top\" width=\"15\">
<font size=\"2\">$no</font>
</td>
<td bgcolor=\"$warna\" width=\"570\">
<table border=\"0\" width=\"100&#37;\">
<tr>
<td>
<font size=\"1\">$row[2]</font><br>
<font size=\"2\"><b>$row[3]</b></font>
</td>
";
echo "<td align=\"right\" valign=\"top\">";
if (trim($row[4]) != "") {
echo "<a href=\"mailto:$row[4]\"><img src=\"imgs/email.gif\" border=\"0\" alt=\"$row[4]\"></a>";
}
if (trim($row[6]) != "" && trim($row[6]) != "http://") {
if (ereg("^http://", trim($row[6]))) echo " <a href=\"$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
else echo " <a href=\"http://$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
}
echo '</td></tr></table>';
echo "<br><table border=\"0\" width=\"100%\">
<tr><td width=\"5\">&nbsp;</td><td>
<font size=\"2\" face=\"$message_font_face\" size=\"$message_font_size\">".stripslashes($row[5])."</font>
</td></tr>
</table>


Sorry about the whole guestbook thing, but I thought when you asked me to post data, that it was easier to have all the information. I work in software support for a simulation company, and I hate nothing more then when a customer sends me only the piece that "they" think it is, if they knew the problem they could fix it. I am sorry I sent the whole thing, it just seemed that there were a ton of questions about this same guestbook, so I was hoping someone might be slightly familiar and have some suggestions.

markowi3
01-14-2008, 04:02 PM
sorry, wrong paste. Here is the section of the index.php that I believe creates that table of the guest comments.


if ($jmlrec == 0) {
echo '<tr><td colspan="3" bgcolor="#FFE1E1" align="center"><font size="3">There are no entries yet.</font></td></tr>';
}
$w = 0; //--Color
for ($i=0; $i<$max_entry_per_page; $i++) {
$nomrec++;
$no++;
//$no--;
$recno = $nomrec-1;
if (isset($record[$recno])) {
$row = explode("|~|",$record[$recno]);
if ($w==0) {
$warna = $table_content_1a;
$warna2 = $table_content_1b;
$w=1;
} else {
$warna = $table_content_2a;
$warna2 = $table_content_2b;
$w=0;
}
echo "<tr>
<td bgcolor=\"$warna2\" align=\"center\" valign=\"top\" width=\"15\">
<font size=\"2\">$no</font>
</td>
<td bgcolor=\"$warna\" width=\"570\">
<table border=\"0\" width=\"100&#37;\">
<tr>
<td>
<font size=\"1\">$row[2]</font><br>
<font size=\"2\"><b>$row[3]</b></font>
</td>
";
echo "<td align=\"right\" valign=\"top\">";
if (trim($row[4]) != "") {
echo "<a href=\"mailto:$row[4]\"><img src=\"imgs/email.gif\" border=\"0\" alt=\"$row[4]\"></a>";
}
if (trim($row[6]) != "" && trim($row[6]) != "http://") {
if (ereg("^http://", trim($row[6]))) echo " <a href=\"$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
else echo " <a href=\"http://$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
}
echo '</td></tr></table>';
echo "<br><table border=\"0\" width=\"100%\">
<tr><td width=\"5\">&nbsp;</td><td>
<font size=\"2\" face=\"$message_font_face\" size=\"$message_font_size\">".stripslashes($row[5])."</font>
</td></tr>
</table>
";
echo '</td>';
echo "<td valign=\"top\" bgcolor=\"$warna2\" align=\"center\" width=\"15\">
<a href=\"$self?do=del&id=$row[1]&page=$page\">
<img src=\"imgs/del.gif\" alt=\"Delete entry # $no\" border=0 align=\"center\"></a>
</td>
</tr>";
} //--end if
} //--end for
echo "<tr><td colspan=\"3\" bgcolor=\"$table_bottom\" align=\"center\" width=\"600\"><font size=\"2\">";
if ($jml_page > 1) {
if ($page != 1) echo "[<a href=\"$self?page=1\">Top</a>] "; else echo '[Top] ';
echo 'Page # ';
if ($jml_page > 10) {
if ($page < 5) {
$start = 1;
$stop = 10;
} elseif ($jml_page - $page < 5) {
$start = $jml_page - 9;
$stop = $jml_page;
} else {
$start = $page-4;
$stop = $page+5;
}
if ($start != 1) echo '... ';
for ($p=$start; $p<=$stop; $p++) {
if ($p == $page) echo "<font color=\"$active_link\"><b>$p</b></font>&nbsp;&nbsp;";
else echo "<a href=\"$self?page=$p\">$p</a>&nbsp;&nbsp;";
}
if ($stop != $jml_page) echo '... ';
echo "of $jml_page ";
} else {
for ($p=1; $p<=$jml_page; $p++) {
if ($p == $page) echo "<font color=\"$active_link\"><b>$p</b></font>&nbsp;&nbsp;";
else echo "<a href=\"$self?page=$p\">$p</a>&nbsp;&nbsp;";
}
}
if ($page != $jml_page) echo "[<a href=\"$self?page=$jml_page\">Bottom</a>]";
else echo '[bottom]';
} else echo 'Page #1 of 1';
echo '</font></td></tr>';
?>
</table>


I can only admit that I dont know enough about the coding and all the loops to figure out what exactly is making it so big.

Thanks

markowi3
01-14-2008, 04:16 PM
Thank you so much for taking the time to look at that. Being new to php I spent two days looking at the code figuring I had to have messed that up. Thank you, I only wish you could help with my oscommerce stuff now :)

Leslie

mlse
01-14-2008, 04:18 PM
Hi, I'm glad your problem is fixed! Sorry, I was a little harsh there :)

markowi3
01-14-2008, 04:25 PM
No problem, I am sure people just post things to have others fix without trying. Matter of fact, I got a email from a customer today asking me something that is evident in the docs, I only wish I could have said to him did you look it up, think the boss might not have been so happy though.
Thanks again.

Leslie



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum