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 
Warning: fread(): Length parameter must be greater than 0  XML
Forum Index » Support Forum
Author Message
Anonymous



Guestbook 2.3.1
Has been working fine for at least 6 months with entries ok.

Then all of a sudden this warning appears on the top of the index page. Also the same message in the 'sign guestbook' and 'admin' page's.

Warning: fread(): Length parameter must be greater than 0. in /home/www/mysiteaddress.com/guestbook/lib/template.class.php on line 53

Any ideas and help appreciated.
Id rather ask for help then try and fix it and end up making things worse then they are.

Heres a copy of the actual template.class.php page
Permission is 644

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

class gb_template {

var $template = array();
var $root_dir;
var $LANG;
var $plain_html = array();

function gb_template($path='') {
$this->root_dir = $path;
}

function set_rootdir($tpl_dir) {
if (!is_dir($tpl_dir)) {
return false;
}
$this->root_dir = $tpl_dir;
return true;
}

function set_lang($language='') {
if (!empty($language) && file_exists("$this->root_dir/lang/$language.php")) {
$this->language = $language;
} else {
$this->language = "english";
}
return $this->language;
}

function get_content() {
if (!isset($this->LANG)) {
include "$this->root_dir/lang/".$this->language.".php";
$this->LANG =& $LANG;
$this->WEEKDAY =& $weekday;
$this->MONTHS =& $months;
}
return $this->LANG;
}

function get_template($tpl) {
if (!isset($this->template[$tpl])) {
$filename = "$this->root_dir/templates/$tpl";
if (file_exists("$filename")) {
$fd = fopen ($filename, "r");
$this->template[$tpl] = fread ($fd, filesize ($filename));
fclose ($fd);
$this->template[$tpl] = ereg_replace("\"", "\\\"", $this->template[$tpl]);
}
}
return $this->template[$tpl];
}

}

?>
==================================

Thanks in advance
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

A quick go with the SEARCH function of this forum would show that this problem has come up before. One of your template files has either been deleted or is now empty.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
Anonymous



Thats interesting because i did a search first before posting and found nothing?
What words did you use or where are the posts?

How does a template become empty or deleted when i havent touched the guestbook for about 6 months?, or the website for that matter.
Regards
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

maybe it got messed up during a hard drive change in your server, shouldn't happen though. Check your template files in an FTP program to see their last modified dates.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
Anonymous



Are you talking about a template in the /guestbook/lib or a template in the /templates directory?

Both of those directorys mentioned above have an 'index.html' page which is empty/blank.

The actual path to the guestbook on the website (URL) is /guestbook/index.php

Im not sure why all of a sudden it has just started doing that.
Its been working fine since install.

What can i do?
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

I mean check the files in templates folder. One of them appears to have either got deleted or emptyied. In theory it shouldn't happen but in theory the world is perfect.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
Anonymous



Yes, your right. The index.html page is empty in /templates.
The index.html page is also empty in /lib.

What can i do to restore it/them without screwing up the rest of the guestbook?

Or rather, how do i backup the guestbook to make modifications or will it not affect it if i overwrite the /templates/index.html page with the original?
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

Well if you didn't edit them simply upload a new copy by downloading the script again. If your index pages have become blank it sounds like somebody accessed your server or the server got hit by a worm. What other scripts are you running and are they upto date ?

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
Anonymous



I just downloaded the script again and had a look at the index pages in those directorys and theres nothing in them anyhow? They are empty.

Im running phpbb2 on a second mysql DB.
Same as on this site.
But they are not connected in any way.
Also there is nothing wrong with phpbb2.

I emailed the hosting admin and they say no outages at there end.
(But they probably would say that anyhow even if there was, until proven guilty!).

I notice in the file manager that all files and folders on the entire website were 'last changed' at midnight on the 31st of December 2004.

Thats impossible because i was drunk at the beach making out with what seemed like at the time, a hot girl, on new years. LOL
Auron
Expert
[Avatar]

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

ClueBee wrote:Thats interesting because i did a search first before posting and found nothing?
What words did you use or where are the posts?


Words to use....

Warning: fread(): Length parameter must be greater than 0

or Warning: fread():
or Length parameter must be greater than 0.

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]
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline

Sorry yeah the index.htmlpage is only in there to prevent people getting a directory listing. I mean you need to check the .php files in templates and check to see if any are missing. As I said, if you haven't editted the templates you could simply download the script again and upload the template files from it.

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
Anonymous



Thanks for help but i have to get some sleep.
Back later in 6 hours.
Anonymous



Just read your last post as i was switching off the light....

When i installed months ago i did edit the templates or customize a few of them if you like but it was minor really. Just cosmetic stuff nothing spectacular.

Everything seemed to be working fine since last year, then recently that happened so im not sure why or how it would do that all of a sudden. Strange.

How do i go about preserving the layout in the index.php page from changing when i upload the original templates?

I think i may have a backup copy on CD from a couple of months ago.
I usually make backups for when this happens.

Maybe i could backup everything first and then rollback to 2004's backup?

Ok im really going to sleep now.. no encore. lol
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum